// 原始文件
// https://azurecomcdn.azureedge.net/cvt-5b82bf40130b353a6e843258e52aef22bfb6a4252375c7c35d6dd3cf1296330e/scripts/Acom/Components/cognitiveServicesDemos/speechJsSdk/microsoft.cognitiveservices.speech.sdk.bundle.js
debugger ;!function(e) {
    var t = {};
    function r(n) {
        if (t[n])
            return t[n].exports;
        var i = t[n] = {
            i: n,
            l: !1,
            exports: {}
        };
        return e[n].call(i.exports, i, i.exports, r),
        i.l = !0,
        i.exports
    }
    r.m = e,
    r.c = t,
    r.d = function(e, t, n) {
        r.o(e, t) || Object.defineProperty(e, t, {
            enumerable: !0,
            get: n
        })
    }
    ,
    r.r = function(e) {
        "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
            value: "Module"
        }),
        Object.defineProperty(e, "__esModule", {
            value: !0
        })
    }
    ,
    r.t = function(e, t) {
        if (1 & t && (e = r(e)),
        8 & t)
            return e;
        if (4 & t && "object" == typeof e && e && e.__esModule)
            return e;
        var n = Object.create(null);
        if (r.r(n),
        Object.defineProperty(n, "default", {
            enumerable: !0,
            value: e
        }),
        2 & t && "string" != typeof e)
            for (var i in e)
                r.d(n, i, function(t) {
                    return e[t]
                }
                .bind(null, i));
        return n
    }
    ,
    r.n = function(e) {
        var t = e && e.__esModule ? function() {
            return e.default
        }
        : function() {
            return e
        }
        ;
        return r.d(t, "a", t),
        t
    }
    ,
    r.o = function(e, t) {
        return Object.prototype.hasOwnProperty.call(e, t)
    }
    ,
    r.p = "",
    r(r.s = 0)
}([function(e, t, r) {
    window.SpeechSDK = r(1)
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__createBinding || (Object.create ? function(e, t, r, n) {
        void 0 === n && (n = r),
        Object.defineProperty(e, n, {
            enumerable: !0,
            get: function() {
                return t[r]
            }
        })
    }
    : function(e, t, r, n) {
        void 0 === n && (n = r),
        e[n] = t[r]
    }
    )
      , i = this && this.__exportStar || function(e, t) {
        for (var r in e)
            "default" === r || t.hasOwnProperty(r) || n(t, e, r)
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    });
    var o = r(2);
    r(4).Events.instance.attachListener(new o.ConsoleLoggingListener),
    i(r(61), t)
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__createBinding || (Object.create ? function(e, t, r, n) {
        void 0 === n && (n = r),
        Object.defineProperty(e, n, {
            enumerable: !0,
            get: function() {
                return t[r]
            }
        })
    }
    : function(e, t, r, n) {
        void 0 === n && (n = r),
        e[n] = t[r]
    }
    )
      , i = this && this.__exportStar || function(e, t) {
        for (var r in e)
            "default" === r || t.hasOwnProperty(r) || n(t, e, r)
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    i(r(3), t),
    i(r(51), t),
    i(r(52), t),
    i(r(229), t),
    i(r(230), t),
    i(r(231), t),
    i(r(232), t),
    i(r(245), t),
    i(r(246), t),
    i(r(247), t),
    i(r(207), t)
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConsoleLoggingListener = void 0;
    var n = r(4)
      , i = function(e) {
        var t = this;
        void 0 === e && (e = n.EventType.Warning),
        this.onEvent = function(e) {
            if (e.eventType >= t.privLogLevelFilter) {
                var r = t.toString(e);
                switch (e.eventType) {
                case n.EventType.Debug:
                    console.debug(r);
                    break;
                case n.EventType.Info:
                    console.info(r);
                    break;
                case n.EventType.Warning:
                    console.warn(r);
                    break;
                case n.EventType.Error:
                    console.error(r);
                    break;
                default:
                    console.log(r)
                }
            }
        }
        ,
        this.toString = function(e) {
            var t = ["" + e.EventTime, "" + e.Name];
            for (var r in e)
                if (r && e.hasOwnProperty(r) && "eventTime" !== r && "eventType" !== r && "eventId" !== r && "name" !== r && "constructor" !== r) {
                    var n = e[r]
                      , i = "<NULL>";
                    null != n && (i = "number" == typeof n || "string" == typeof n ? n.toString() : JSON.stringify(n)),
                    t.push(r + ": " + i)
                }
            return t.join(" | ")
        }
        ,
        this.privLogLevelFilter = e
    };
    t.ConsoleLoggingListener = i
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__createBinding || (Object.create ? function(e, t, r, n) {
        void 0 === n && (n = r),
        Object.defineProperty(e, n, {
            enumerable: !0,
            get: function() {
                return t[r]
            }
        })
    }
    : function(e, t, r, n) {
        void 0 === n && (n = r),
        e[n] = t[r]
    }
    )
      , i = this && this.__exportStar || function(e, t) {
        for (var r in e)
            "default" === r || t.hasOwnProperty(r) || n(t, e, r)
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    i(r(5), t),
    i(r(23), t),
    i(r(24), t),
    i(r(26), t),
    i(r(27), t),
    i(r(25), t),
    i(r(28), t),
    i(r(29), t),
    i(r(7), t),
    i(r(30), t),
    i(r(31), t),
    i(r(32), t),
    i(r(33), t),
    i(r(34), t),
    i(r(35), t),
    i(r(36), t),
    i(r(37), t),
    i(r(38), t),
    i(r(39), t),
    i(r(6), t),
    i(r(40), t),
    i(r(41), t),
    i(r(42), t),
    i(r(43), t),
    i(r(44), t);
    var o = r(45);
    Object.defineProperty(t, "TranslationStatus", {
        enumerable: !0,
        get: function() {
            return o.TranslationStatus
        }
    }),
    i(r(46), t),
    i(r(47), t),
    i(r(48), t),
    i(r(49), t),
    i(r(50), t)
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.AudioStreamNodeErrorEvent = t.AudioStreamNodeDetachedEvent = t.AudioStreamNodeAttachedEvent = t.AudioStreamNodeAttachingEvent = t.AudioStreamNodeEvent = t.AudioSourceErrorEvent = t.AudioSourceOffEvent = t.AudioSourceReadyEvent = t.AudioSourceInitializingEvent = t.AudioSourceEvent = void 0;
    var o = r(6)
      , s = function(e) {
        function t(t, r, n) {
            void 0 === n && (n = o.EventType.Info);
            var i = e.call(this, t, n) || this;
            return i.privAudioSourceId = r,
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "audioSourceId", {
            get: function() {
                return this.privAudioSourceId
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(o.PlatformEvent);
    t.AudioSourceEvent = s;
    var a = function(e) {
        function t(t) {
            return e.call(this, "AudioSourceInitializingEvent", t) || this
        }
        return i(t, e),
        t
    }(s);
    t.AudioSourceInitializingEvent = a;
    var c = function(e) {
        function t(t) {
            return e.call(this, "AudioSourceReadyEvent", t) || this
        }
        return i(t, e),
        t
    }(s);
    t.AudioSourceReadyEvent = c;
    var u = function(e) {
        function t(t) {
            return e.call(this, "AudioSourceOffEvent", t) || this
        }
        return i(t, e),
        t
    }(s);
    t.AudioSourceOffEvent = u;
    var p = function(e) {
        function t(t, r) {
            var n = e.call(this, "AudioSourceErrorEvent", t, o.EventType.Error) || this;
            return n.privError = r,
            n
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "error", {
            get: function() {
                return this.privError
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(s);
    t.AudioSourceErrorEvent = p;
    var l = function(e) {
        function t(t, r, n) {
            var i = e.call(this, t, r) || this;
            return i.privAudioNodeId = n,
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "audioNodeId", {
            get: function() {
                return this.privAudioNodeId
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(s);
    t.AudioStreamNodeEvent = l;
    var f = function(e) {
        function t(t, r) {
            return e.call(this, "AudioStreamNodeAttachingEvent", t, r) || this
        }
        return i(t, e),
        t
    }(l);
    t.AudioStreamNodeAttachingEvent = f;
    var h = function(e) {
        function t(t, r) {
            return e.call(this, "AudioStreamNodeAttachedEvent", t, r) || this
        }
        return i(t, e),
        t
    }(l);
    t.AudioStreamNodeAttachedEvent = h;
    var v = function(e) {
        function t(t, r) {
            return e.call(this, "AudioStreamNodeDetachedEvent", t, r) || this
        }
        return i(t, e),
        t
    }(l);
    t.AudioStreamNodeDetachedEvent = v;
    var d = function(e) {
        function t(t, r, n) {
            var i = e.call(this, "AudioStreamNodeErrorEvent", t, r) || this;
            return i.privError = n,
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "error", {
            get: function() {
                return this.privError
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(l);
    t.AudioStreamNodeErrorEvent = d
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.PlatformEvent = t.EventType = void 0;
    var n = r(7);
    !function(e) {
        e[e.Debug = 0] = "Debug",
        e[e.Info = 1] = "Info",
        e[e.Warning = 2] = "Warning",
        e[e.Error = 3] = "Error"
    }(t.EventType || (t.EventType = {}));
    var i = function() {
        function e(e, t) {
            this.privName = e,
            this.privEventId = n.createNoDashGuid(),
            this.privEventTime = (new Date).toISOString(),
            this.privEventType = t,
            this.privMetadata = {}
        }
        return Object.defineProperty(e.prototype, "name", {
            get: function() {
                return this.privName
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "eventId", {
            get: function() {
                return this.privEventId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "eventTime", {
            get: function() {
                return this.privEventTime
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "eventType", {
            get: function() {
                return this.privEventType
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "metadata", {
            get: function() {
                return this.privMetadata
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.PlatformEvent = i
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.createNoDashGuid = t.createGuid = void 0;
    var n = r(8)
      , i = function() {
        return n.v4()
    };
    t.createGuid = i;
    t.createNoDashGuid = function() {
        return i().replace(new RegExp("-","g"), "").toUpperCase()
    }
}
, function(e, t, r) {
    "use strict";
    r.r(t);
    var n = r(9);
    r.d(t, "v1", (function() {
        return n.default
    }
    ));
    var i = r(14);
    r.d(t, "v3", (function() {
        return i.default
    }
    ));
    var o = r(18);
    r.d(t, "v4", (function() {
        return o.default
    }
    ));
    var s = r(19);
    r.d(t, "v5", (function() {
        return s.default
    }
    ));
    var a = r(21);
    r.d(t, "NIL", (function() {
        return a.default
    }
    ));
    var c = r(22);
    r.d(t, "version", (function() {
        return c.default
    }
    ));
    var u = r(12);
    r.d(t, "validate", (function() {
        return u.default
    }
    ));
    var p = r(11);
    r.d(t, "stringify", (function() {
        return p.default
    }
    ));
    var l = r(16);
    r.d(t, "parse", (function() {
        return l.default
    }
    ))
}
, function(e, t, r) {
    "use strict";
    r.r(t);
    var n, i, o = r(10), s = r(11), a = 0, c = 0;
    t.default = function(e, t, r) {
        var u = t && r || 0
          , p = t || new Array(16)
          , l = (e = e || {}).node || n
          , f = void 0 !== e.clockseq ? e.clockseq : i;
        if (null == l || null == f) {
            var h = e.random || (e.rng || o.default)();
            null == l && (l = n = [1 | h[0], h[1], h[2], h[3], h[4], h[5]]),
            null == f && (f = i = 16383 & (h[6] << 8 | h[7]))
        }
        var v = void 0 !== e.msecs ? e.msecs : Date.now()
          , d = void 0 !== e.nsecs ? e.nsecs : c + 1
          , y = v - a + (d - c) / 1e4;
        if (y < 0 && void 0 === e.clockseq && (f = f + 1 & 16383),
        (y < 0 || v > a) && void 0 === e.nsecs && (d = 0),
        d >= 1e4)
            throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
        a = v,
        c = d,
        i = f;
        var g = (1e4 * (268435455 & (v += 122192928e5)) + d) % 4294967296;
        p[u++] = g >>> 24 & 255,
        p[u++] = g >>> 16 & 255,
        p[u++] = g >>> 8 & 255,
        p[u++] = 255 & g;
        var m = v / 4294967296 * 1e4 & 268435455;
        p[u++] = m >>> 8 & 255,
        p[u++] = 255 & m,
        p[u++] = m >>> 24 & 15 | 16,
        p[u++] = m >>> 16 & 255,
        p[u++] = f >>> 8 | 128,
        p[u++] = 255 & f;
        for (var b = 0; b < 6; ++b)
            p[u + b] = l[b];
        return t || Object(s.default)(p)
    }
}
, function(e, t, r) {
    "use strict";
    var n;
    r.r(t),
    r.d(t, "default", (function() {
        return o
    }
    ));
    var i = new Uint8Array(16);
    function o() {
        if (!n && !(n = "undefined" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && "function" == typeof msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto)))
            throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
        return n(i)
    }
}
, function(e, t, r) {
    "use strict";
    r.r(t);
    for (var n = r(12), i = [], o = 0; o < 256; ++o)
        i.push((o + 256).toString(16).substr(1));
    t.default = function(e) {
        var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0
          , r = (i[e[t + 0]] + i[e[t + 1]] + i[e[t + 2]] + i[e[t + 3]] + "-" + i[e[t + 4]] + i[e[t + 5]] + "-" + i[e[t + 6]] + i[e[t + 7]] + "-" + i[e[t + 8]] + i[e[t + 9]] + "-" + i[e[t + 10]] + i[e[t + 11]] + i[e[t + 12]] + i[e[t + 13]] + i[e[t + 14]] + i[e[t + 15]]).toLowerCase();
        if (!Object(n.default)(r))
            throw TypeError("Stringified UUID is invalid");
        return r
    }
}
, function(e, t, r) {
    "use strict";
    r.r(t);
    var n = r(13);
    t.default = function(e) {
        return "string" == typeof e && n.default.test(e)
    }
}
, function(e, t, r) {
    "use strict";
    r.r(t),
    t.default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i
}
, function(e, t, r) {
    "use strict";
    r.r(t);
    var n = r(15)
      , i = r(17)
      , o = Object(n.default)("v3", 48, i.default);
    t.default = o
}
, function(e, t, r) {
    "use strict";
    r.r(t),
    r.d(t, "DNS", (function() {
        return o
    }
    )),
    r.d(t, "URL", (function() {
        return s
    }
    ));
    var n = r(11)
      , i = r(16);
    var o = "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
      , s = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
    t.default = function(e, t, r) {
        function a(e, o, s, a) {
            if ("string" == typeof e && (e = function(e) {
                e = unescape(encodeURIComponent(e));
                for (var t = [], r = 0; r < e.length; ++r)
                    t.push(e.charCodeAt(r));
                return t
            }(e)),
            "string" == typeof o && (o = Object(i.default)(o)),
            16 !== o.length)
                throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
            var c = new Uint8Array(16 + e.length);
            if (c.set(o),
            c.set(e, o.length),
            (c = r(c))[6] = 15 & c[6] | t,
            c[8] = 63 & c[8] | 128,
            s) {
                a = a || 0;
                for (var u = 0; u < 16; ++u)
                    s[a + u] = c[u];
                return s
            }
            return Object(n.default)(c)
        }
        try {
            a.name = e
        } catch (e) {}
        return a.DNS = o,
        a.URL = s,
        a
    }
}
, function(e, t, r) {
    "use strict";
    r.r(t);
    var n = r(12);
    t.default = function(e) {
        if (!Object(n.default)(e))
            throw TypeError("Invalid UUID");
        var t, r = new Uint8Array(16);
        return r[0] = (t = parseInt(e.slice(0, 8), 16)) >>> 24,
        r[1] = t >>> 16 & 255,
        r[2] = t >>> 8 & 255,
        r[3] = 255 & t,
        r[4] = (t = parseInt(e.slice(9, 13), 16)) >>> 8,
        r[5] = 255 & t,
        r[6] = (t = parseInt(e.slice(14, 18), 16)) >>> 8,
        r[7] = 255 & t,
        r[8] = (t = parseInt(e.slice(19, 23), 16)) >>> 8,
        r[9] = 255 & t,
        r[10] = (t = parseInt(e.slice(24, 36), 16)) / 1099511627776 & 255,
        r[11] = t / 4294967296 & 255,
        r[12] = t >>> 24 & 255,
        r[13] = t >>> 16 & 255,
        r[14] = t >>> 8 & 255,
        r[15] = 255 & t,
        r
    }
}
, function(e, t, r) {
    "use strict";
    function n(e) {
        return 14 + (e + 64 >>> 9 << 4) + 1
    }
    function i(e, t) {
        var r = (65535 & e) + (65535 & t);
        return (e >> 16) + (t >> 16) + (r >> 16) << 16 | 65535 & r
    }
    function o(e, t, r, n, o, s) {
        return i((a = i(i(t, e), i(n, s))) << (c = o) | a >>> 32 - c, r);
        var a, c
    }
    function s(e, t, r, n, i, s, a) {
        return o(t & r | ~t & n, e, t, i, s, a)
    }
    function a(e, t, r, n, i, s, a) {
        return o(t & n | r & ~n, e, t, i, s, a)
    }
    function c(e, t, r, n, i, s, a) {
        return o(t ^ r ^ n, e, t, i, s, a)
    }
    function u(e, t, r, n, i, s, a) {
        return o(r ^ (t | ~n), e, t, i, s, a)
    }
    r.r(t),
    t.default = function(e) {
        if ("string" == typeof e) {
            var t = unescape(encodeURIComponent(e));
            e = new Uint8Array(t.length);
            for (var r = 0; r < t.length; ++r)
                e[r] = t.charCodeAt(r)
        }
        return function(e) {
            for (var t = [], r = 32 * e.length, n = "0123456789abcdef", i = 0; i < r; i += 8) {
                var o = e[i >> 5] >>> i % 32 & 255
                  , s = parseInt(n.charAt(o >>> 4 & 15) + n.charAt(15 & o), 16);
                t.push(s)
            }
            return t
        }(function(e, t) {
            e[t >> 5] |= 128 << t % 32,
            e[n(t) - 1] = t;
            for (var r = 1732584193, o = -271733879, p = -1732584194, l = 271733878, f = 0; f < e.length; f += 16) {
                var h = r
                  , v = o
                  , d = p
                  , y = l;
                r = s(r, o, p, l, e[f], 7, -680876936),
                l = s(l, r, o, p, e[f + 1], 12, -389564586),
                p = s(p, l, r, o, e[f + 2], 17, 606105819),
                o = s(o, p, l, r, e[f + 3], 22, -1044525330),
                r = s(r, o, p, l, e[f + 4], 7, -176418897),
                l = s(l, r, o, p, e[f + 5], 12, 1200080426),
                p = s(p, l, r, o, e[f + 6], 17, -1473231341),
                o = s(o, p, l, r, e[f + 7], 22, -45705983),
                r = s(r, o, p, l, e[f + 8], 7, 1770035416),
                l = s(l, r, o, p, e[f + 9], 12, -1958414417),
                p = s(p, l, r, o, e[f + 10], 17, -42063),
                o = s(o, p, l, r, e[f + 11], 22, -1990404162),
                r = s(r, o, p, l, e[f + 12], 7, 1804603682),
                l = s(l, r, o, p, e[f + 13], 12, -40341101),
                p = s(p, l, r, o, e[f + 14], 17, -1502002290),
                r = a(r, o = s(o, p, l, r, e[f + 15], 22, 1236535329), p, l, e[f + 1], 5, -165796510),
                l = a(l, r, o, p, e[f + 6], 9, -1069501632),
                p = a(p, l, r, o, e[f + 11], 14, 643717713),
                o = a(o, p, l, r, e[f], 20, -373897302),
                r = a(r, o, p, l, e[f + 5], 5, -701558691),
                l = a(l, r, o, p, e[f + 10], 9, 38016083),
                p = a(p, l, r, o, e[f + 15], 14, -660478335),
                o = a(o, p, l, r, e[f + 4], 20, -405537848),
                r = a(r, o, p, l, e[f + 9], 5, 568446438),
                l = a(l, r, o, p, e[f + 14], 9, -1019803690),
                p = a(p, l, r, o, e[f + 3], 14, -187363961),
                o = a(o, p, l, r, e[f + 8], 20, 1163531501),
                r = a(r, o, p, l, e[f + 13], 5, -1444681467),
                l = a(l, r, o, p, e[f + 2], 9, -51403784),
                p = a(p, l, r, o, e[f + 7], 14, 1735328473),
                r = c(r, o = a(o, p, l, r, e[f + 12], 20, -1926607734), p, l, e[f + 5], 4, -378558),
                l = c(l, r, o, p, e[f + 8], 11, -2022574463),
                p = c(p, l, r, o, e[f + 11], 16, 1839030562),
                o = c(o, p, l, r, e[f + 14], 23, -35309556),
                r = c(r, o, p, l, e[f + 1], 4, -1530992060),
                l = c(l, r, o, p, e[f + 4], 11, 1272893353),
                p = c(p, l, r, o, e[f + 7], 16, -155497632),
                o = c(o, p, l, r, e[f + 10], 23, -1094730640),
                r = c(r, o, p, l, e[f + 13], 4, 681279174),
                l = c(l, r, o, p, e[f], 11, -358537222),
                p = c(p, l, r, o, e[f + 3], 16, -722521979),
                o = c(o, p, l, r, e[f + 6], 23, 76029189),
                r = c(r, o, p, l, e[f + 9], 4, -640364487),
                l = c(l, r, o, p, e[f + 12], 11, -421815835),
                p = c(p, l, r, o, e[f + 15], 16, 530742520),
                r = u(r, o = c(o, p, l, r, e[f + 2], 23, -995338651), p, l, e[f], 6, -198630844),
                l = u(l, r, o, p, e[f + 7], 10, 1126891415),
                p = u(p, l, r, o, e[f + 14], 15, -1416354905),
                o = u(o, p, l, r, e[f + 5], 21, -57434055),
                r = u(r, o, p, l, e[f + 12], 6, 1700485571),
                l = u(l, r, o, p, e[f + 3], 10, -1894986606),
                p = u(p, l, r, o, e[f + 10], 15, -1051523),
                o = u(o, p, l, r, e[f + 1], 21, -2054922799),
                r = u(r, o, p, l, e[f + 8], 6, 1873313359),
                l = u(l, r, o, p, e[f + 15], 10, -30611744),
                p = u(p, l, r, o, e[f + 6], 15, -1560198380),
                o = u(o, p, l, r, e[f + 13], 21, 1309151649),
                r = u(r, o, p, l, e[f + 4], 6, -145523070),
                l = u(l, r, o, p, e[f + 11], 10, -1120210379),
                p = u(p, l, r, o, e[f + 2], 15, 718787259),
                o = u(o, p, l, r, e[f + 9], 21, -343485551),
                r = i(r, h),
                o = i(o, v),
                p = i(p, d),
                l = i(l, y)
            }
            return [r, o, p, l]
        }(function(e) {
            if (0 === e.length)
                return [];
            for (var t = 8 * e.length, r = new Uint32Array(n(t)), i = 0; i < t; i += 8)
                r[i >> 5] |= (255 & e[i / 8]) << i % 32;
            return r
        }(e), 8 * e.length))
    }
}
, function(e, t, r) {
    "use strict";
    r.r(t);
    var n = r(10)
      , i = r(11);
    t.default = function(e, t, r) {
        var o = (e = e || {}).random || (e.rng || n.default)();
        if (o[6] = 15 & o[6] | 64,
        o[8] = 63 & o[8] | 128,
        t) {
            r = r || 0;
            for (var s = 0; s < 16; ++s)
                t[r + s] = o[s];
            return t
        }
        return Object(i.default)(o)
    }
}
, function(e, t, r) {
    "use strict";
    r.r(t);
    var n = r(15)
      , i = r(20)
      , o = Object(n.default)("v5", 80, i.default);
    t.default = o
}
, function(e, t, r) {
    "use strict";
    function n(e, t, r, n) {
        switch (e) {
        case 0:
            return t & r ^ ~t & n;
        case 1:
            return t ^ r ^ n;
        case 2:
            return t & r ^ t & n ^ r & n;
        case 3:
            return t ^ r ^ n
        }
    }
    function i(e, t) {
        return e << t | e >>> 32 - t
    }
    r.r(t),
    t.default = function(e) {
        var t = [1518500249, 1859775393, 2400959708, 3395469782]
          , r = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
        if ("string" == typeof e) {
            var o = unescape(encodeURIComponent(e));
            e = [];
            for (var s = 0; s < o.length; ++s)
                e.push(o.charCodeAt(s))
        } else
            Array.isArray(e) || (e = Array.prototype.slice.call(e));
        e.push(128);
        for (var a = e.length / 4 + 2, c = Math.ceil(a / 16), u = new Array(c), p = 0; p < c; ++p) {
            for (var l = new Uint32Array(16), f = 0; f < 16; ++f)
                l[f] = e[64 * p + 4 * f] << 24 | e[64 * p + 4 * f + 1] << 16 | e[64 * p + 4 * f + 2] << 8 | e[64 * p + 4 * f + 3];
            u[p] = l
        }
        u[c - 1][14] = 8 * (e.length - 1) / Math.pow(2, 32),
        u[c - 1][14] = Math.floor(u[c - 1][14]),
        u[c - 1][15] = 8 * (e.length - 1) & 4294967295;
        for (var h = 0; h < c; ++h) {
            for (var v = new Uint32Array(80), d = 0; d < 16; ++d)
                v[d] = u[h][d];
            for (var y = 16; y < 80; ++y)
                v[y] = i(v[y - 3] ^ v[y - 8] ^ v[y - 14] ^ v[y - 16], 1);
            for (var g = r[0], m = r[1], b = r[2], S = r[3], C = r[4], P = 0; P < 80; ++P) {
                var w = Math.floor(P / 20)
                  , R = i(g, 5) + n(w, m, b, S) + C + t[w] + v[P] >>> 0;
                C = S,
                S = b,
                b = i(m, 30) >>> 0,
                m = g,
                g = R
            }
            r[0] = r[0] + g >>> 0,
            r[1] = r[1] + m >>> 0,
            r[2] = r[2] + b >>> 0,
            r[3] = r[3] + S >>> 0,
            r[4] = r[4] + C >>> 0
        }
        return [r[0] >> 24 & 255, r[0] >> 16 & 255, r[0] >> 8 & 255, 255 & r[0], r[1] >> 24 & 255, r[1] >> 16 & 255, r[1] >> 8 & 255, 255 & r[1], r[2] >> 24 & 255, r[2] >> 16 & 255, r[2] >> 8 & 255, 255 & r[2], r[3] >> 24 & 255, r[3] >> 16 & 255, r[3] >> 8 & 255, 255 & r[3], r[4] >> 24 & 255, r[4] >> 16 & 255, r[4] >> 8 & 255, 255 & r[4]]
    }
}
, function(e, t, r) {
    "use strict";
    r.r(t),
    t.default = "00000000-0000-0000-0000-000000000000"
}
, function(e, t, r) {
    "use strict";
    r.r(t);
    var n = r(12);
    t.default = function(e) {
        if (!Object(n.default)(e))
            throw TypeError("Invalid UUID");
        return parseInt(e.substr(14, 1), 16)
    }
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConnectionMessageSentEvent = t.ConnectionMessageReceivedEvent = t.ConnectionEstablishErrorEvent = t.ConnectionErrorEvent = t.ConnectionClosedEvent = t.ConnectionEstablishedEvent = t.ConnectionStartEvent = t.ConnectionEvent = t.ServiceEvent = void 0;
    var o = r(6)
      , s = function(e) {
        function t(t, r, n) {
            void 0 === n && (n = o.EventType.Info);
            var i = e.call(this, t, n) || this;
            return i.privJsonResult = r,
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "jsonString", {
            get: function() {
                return this.privJsonResult
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(o.PlatformEvent);
    t.ServiceEvent = s;
    var a = function(e) {
        function t(t, r, n) {
            void 0 === n && (n = o.EventType.Info);
            var i = e.call(this, t, n) || this;
            return i.privConnectionId = r,
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "connectionId", {
            get: function() {
                return this.privConnectionId
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(o.PlatformEvent);
    t.ConnectionEvent = a;
    var c = function(e) {
        function t(t, r, n) {
            var i = e.call(this, "ConnectionStartEvent", t) || this;
            return i.privUri = r,
            i.privHeaders = n,
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "uri", {
            get: function() {
                return this.privUri
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "headers", {
            get: function() {
                return this.privHeaders
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(a);
    t.ConnectionStartEvent = c;
    var u = function(e) {
        function t(t, r) {
            return e.call(this, "ConnectionEstablishedEvent", t) || this
        }
        return i(t, e),
        t
    }(a);
    t.ConnectionEstablishedEvent = u;
    var p = function(e) {
        function t(t, r, n) {
            var i = e.call(this, "ConnectionClosedEvent", t, o.EventType.Debug) || this;
            return i.privReason = n,
            i.privStatusCode = r,
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "reason", {
            get: function() {
                return this.privReason
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "statusCode", {
            get: function() {
                return this.privStatusCode
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(a);
    t.ConnectionClosedEvent = p;
    var l = function(e) {
        function t(t, r, n) {
            var i = e.call(this, "ConnectionErrorEvent", t, o.EventType.Debug) || this;
            return i.privMessage = r,
            i.privType = n,
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "message", {
            get: function() {
                return this.privMessage
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "type", {
            get: function() {
                return this.privType
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(a);
    t.ConnectionErrorEvent = l;
    var f = function(e) {
        function t(t, r, n) {
            var i = e.call(this, "ConnectionEstablishErrorEvent", t, o.EventType.Error) || this;
            return i.privStatusCode = r,
            i.privReason = n,
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "reason", {
            get: function() {
                return this.privReason
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "statusCode", {
            get: function() {
                return this.privStatusCode
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(a);
    t.ConnectionEstablishErrorEvent = f;
    var h = function(e) {
        function t(t, r, n) {
            var i = e.call(this, "ConnectionMessageReceivedEvent", t) || this;
            return i.privNetworkReceivedTime = r,
            i.privMessage = n,
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "networkReceivedTime", {
            get: function() {
                return this.privNetworkReceivedTime
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "message", {
            get: function() {
                return this.privMessage
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(a);
    t.ConnectionMessageReceivedEvent = h;
    var v = function(e) {
        function t(t, r, n) {
            var i = e.call(this, "ConnectionMessageSentEvent", t) || this;
            return i.privNetworkSentTime = r,
            i.privMessage = n,
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "networkSentTime", {
            get: function() {
                return this.privNetworkSentTime
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "message", {
            get: function() {
                return this.privMessage
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(a);
    t.ConnectionMessageSentEvent = v
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConnectionMessage = t.MessageType = void 0;
    var n, i = r(25), o = r(7);
    !function(e) {
        e[e.Text = 0] = "Text",
        e[e.Binary = 1] = "Binary"
    }(n = t.MessageType || (t.MessageType = {}));
    var s = function() {
        function e(e, t, r, s) {
            if (this.privBody = null,
            e === n.Text && t && "string" != typeof t)
                throw new i.InvalidOperationError("Payload must be a string");
            if (e === n.Binary && t && !(t instanceof ArrayBuffer))
                throw new i.InvalidOperationError("Payload must be ArrayBuffer");
            switch (this.privMessageType = e,
            this.privBody = t,
            this.privHeaders = r || {},
            this.privId = s || o.createNoDashGuid(),
            this.messageType) {
            case n.Binary:
                this.privSize = null !== this.binaryBody ? this.binaryBody.byteLength : 0;
                break;
            case n.Text:
                this.privSize = this.textBody.length
            }
        }
        return Object.defineProperty(e.prototype, "messageType", {
            get: function() {
                return this.privMessageType
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "headers", {
            get: function() {
                return this.privHeaders
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "body", {
            get: function() {
                return this.privBody
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "textBody", {
            get: function() {
                if (this.privMessageType === n.Binary)
                    throw new i.InvalidOperationError("Not supported for binary message");
                return this.privBody
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "binaryBody", {
            get: function() {
                if (this.privMessageType === n.Text)
                    throw new i.InvalidOperationError("Not supported for text message");
                return this.privBody
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "id", {
            get: function() {
                return this.privId
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.ConnectionMessage = s
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ObjectDisposedError = t.InvalidOperationError = t.ArgumentNullError = void 0;
    var o = function(e) {
        function t(t) {
            var r = e.call(this, t) || this;
            return r.name = "ArgumentNull",
            r.message = t,
            r
        }
        return i(t, e),
        t
    }(Error);
    t.ArgumentNullError = o;
    var s = function(e) {
        function t(t) {
            var r = e.call(this, t) || this;
            return r.name = "InvalidOperation",
            r.message = t,
            r
        }
        return i(t, e),
        t
    }(Error);
    t.InvalidOperationError = s;
    var a = function(e) {
        function t(t, r) {
            var n = e.call(this, r) || this;
            return n.name = t + "ObjectDisposed",
            n.message = r,
            n
        }
        return i(t, e),
        t
    }(Error);
    t.ObjectDisposedError = a
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConnectionOpenResponse = void 0;
    var n = function() {
        function e(e, t) {
            this.privStatusCode = e,
            this.privReason = t
        }
        return Object.defineProperty(e.prototype, "statusCode", {
            get: function() {
                return this.privStatusCode
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "reason", {
            get: function() {
                return this.privReason
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.ConnectionOpenResponse = n
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SendingAgentContextMessageEvent = t.DialogEvent = void 0;
    var o = r(6)
      , s = function(e) {
        function t(t, r) {
            return void 0 === r && (r = o.EventType.Info),
            e.call(this, t, r) || this
        }
        return i(t, e),
        t
    }(o.PlatformEvent);
    t.DialogEvent = s;
    var a = function(e) {
        function t(t) {
            var r = e.call(this, "SendingAgentContextMessageEvent") || this;
            return r.privAgentConfig = t,
            r
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "agentConfig", {
            get: function() {
                return this.privAgentConfig
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(s);
    t.SendingAgentContextMessageEvent = a
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.Events = void 0;
    var n = r(25)
      , i = r(29)
      , o = function() {
        function e() {}
        return Object.defineProperty(e, "instance", {
            get: function() {
                return e.privInstance
            },
            enumerable: !1,
            configurable: !0
        }),
        e.privInstance = new i.EventSource,
        e.setEventSource = function(t) {
            if (!t)
                throw new n.ArgumentNullError("eventSource");
            e.privInstance = t
        }
        ,
        e
    }();
    t.Events = o
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.EventSource = void 0;
    var n = r(25)
      , i = r(7)
      , o = function() {
        function e(e) {
            var t = this;
            this.privEventListeners = {},
            this.privIsDisposed = !1,
            this.onEvent = function(e) {
                if (t.isDisposed())
                    throw new n.ObjectDisposedError("EventSource");
                if (t.metadata)
                    for (var r in t.metadata)
                        r && e.metadata && (e.metadata[r] || (e.metadata[r] = t.metadata[r]));
                for (var i in t.privEventListeners)
                    i && t.privEventListeners[i] && t.privEventListeners[i](e)
            }
            ,
            this.attach = function(e) {
                var r = i.createNoDashGuid();
                return t.privEventListeners[r] = e,
                {
                    detach: function() {
                        return delete t.privEventListeners[r],
                        Promise.resolve()
                    }
                }
            }
            ,
            this.attachListener = function(e) {
                return t.attach(e.onEvent)
            }
            ,
            this.isDisposed = function() {
                return t.privIsDisposed
            }
            ,
            this.dispose = function() {
                t.privEventListeners = null,
                t.privIsDisposed = !0
            }
            ,
            this.privMetadata = e
        }
        return Object.defineProperty(e.prototype, "metadata", {
            get: function() {
                return this.privMetadata
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.EventSource = o
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    })
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConnectionState = void 0,
    function(e) {
        e[e.None = 0] = "None",
        e[e.Connected = 1] = "Connected",
        e[e.Connecting = 2] = "Connecting",
        e[e.Disconnected = 3] = "Disconnected"
    }(t.ConnectionState || (t.ConnectionState = {}))
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    })
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    })
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    })
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    })
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    })
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    })
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    })
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.List = void 0;
    var n = r(25)
      , i = function e(t) {
        var r = this;
        if (this.privSubscriptionIdCounter = 0,
        this.privAddSubscriptions = {},
        this.privRemoveSubscriptions = {},
        this.privDisposedSubscriptions = {},
        this.privDisposeReason = null,
        this.get = function(e) {
            return r.throwIfDisposed(),
            r.privList[e]
        }
        ,
        this.first = function() {
            return r.get(0)
        }
        ,
        this.last = function() {
            return r.get(r.length() - 1)
        }
        ,
        this.add = function(e) {
            r.throwIfDisposed(),
            r.insertAt(r.privList.length, e)
        }
        ,
        this.insertAt = function(e, t) {
            r.throwIfDisposed(),
            0 === e ? r.privList.unshift(t) : e === r.privList.length ? r.privList.push(t) : r.privList.splice(e, 0, t),
            r.triggerSubscriptions(r.privAddSubscriptions)
        }
        ,
        this.removeFirst = function() {
            return r.throwIfDisposed(),
            r.removeAt(0)
        }
        ,
        this.removeLast = function() {
            return r.throwIfDisposed(),
            r.removeAt(r.length() - 1)
        }
        ,
        this.removeAt = function(e) {
            return r.throwIfDisposed(),
            r.remove(e, 1)[0]
        }
        ,
        this.remove = function(e, t) {
            r.throwIfDisposed();
            var n = r.privList.splice(e, t);
            return r.triggerSubscriptions(r.privRemoveSubscriptions),
            n
        }
        ,
        this.clear = function() {
            r.throwIfDisposed(),
            r.remove(0, r.length())
        }
        ,
        this.length = function() {
            return r.throwIfDisposed(),
            r.privList.length
        }
        ,
        this.onAdded = function(e) {
            r.throwIfDisposed();
            var t = r.privSubscriptionIdCounter++;
            return r.privAddSubscriptions[t] = e,
            {
                detach: function() {
                    return delete r.privAddSubscriptions[t],
                    Promise.resolve()
                }
            }
        }
        ,
        this.onRemoved = function(e) {
            r.throwIfDisposed();
            var t = r.privSubscriptionIdCounter++;
            return r.privRemoveSubscriptions[t] = e,
            {
                detach: function() {
                    return delete r.privRemoveSubscriptions[t],
                    Promise.resolve()
                }
            }
        }
        ,
        this.onDisposed = function(e) {
            r.throwIfDisposed();
            var t = r.privSubscriptionIdCounter++;
            return r.privDisposedSubscriptions[t] = e,
            {
                detach: function() {
                    return delete r.privDisposedSubscriptions[t],
                    Promise.resolve()
                }
            }
        }
        ,
        this.join = function(e) {
            return r.throwIfDisposed(),
            r.privList.join(e)
        }
        ,
        this.toArray = function() {
            var e = Array();
            return r.privList.forEach((function(t) {
                e.push(t)
            }
            )),
            e
        }
        ,
        this.any = function(e) {
            return r.throwIfDisposed(),
            e ? r.where(e).length() > 0 : r.length() > 0
        }
        ,
        this.all = function(e) {
            return r.throwIfDisposed(),
            r.where(e).length() === r.length()
        }
        ,
        this.forEach = function(e) {
            r.throwIfDisposed();
            for (var t = 0; t < r.length(); t++)
                e(r.privList[t], t)
        }
        ,
        this.select = function(t) {
            r.throwIfDisposed();
            for (var n = [], i = 0; i < r.privList.length; i++)
                n.push(t(r.privList[i], i));
            return new e(n)
        }
        ,
        this.where = function(t) {
            r.throwIfDisposed();
            for (var n = new e, i = 0; i < r.privList.length; i++)
                t(r.privList[i], i) && n.add(r.privList[i]);
            return n
        }
        ,
        this.orderBy = function(t) {
            return r.throwIfDisposed(),
            new e(r.toArray().sort(t))
        }
        ,
        this.orderByDesc = function(e) {
            return r.throwIfDisposed(),
            r.orderBy((function(t, r) {
                return e(r, t)
            }
            ))
        }
        ,
        this.clone = function() {
            return r.throwIfDisposed(),
            new e(r.toArray())
        }
        ,
        this.concat = function(t) {
            return r.throwIfDisposed(),
            new e(r.privList.concat(t.toArray()))
        }
        ,
        this.concatArray = function(t) {
            return r.throwIfDisposed(),
            new e(r.privList.concat(t))
        }
        ,
        this.isDisposed = function() {
            return null == r.privList
        }
        ,
        this.dispose = function(e) {
            r.isDisposed() || (r.privDisposeReason = e,
            r.privList = null,
            r.privAddSubscriptions = null,
            r.privRemoveSubscriptions = null,
            r.triggerSubscriptions(r.privDisposedSubscriptions))
        }
        ,
        this.throwIfDisposed = function() {
            if (r.isDisposed())
                throw new n.ObjectDisposedError("List",r.privDisposeReason)
        }
        ,
        this.triggerSubscriptions = function(e) {
            if (e)
                for (var t in e)
                    t && e[t]()
        }
        ,
        this.privList = [],
        t)
            for (var i = 0, o = t; i < o.length; i++) {
                var s = o[i];
                this.privList.push(s)
            }
    };
    t.List = i
}
, function(e, t, r) {
    "use strict";
    var n;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.marshalPromiseToCallbacks = t.Sink = t.Deferred = t.PromiseResultEventSource = t.PromiseResult = t.PromiseState = void 0,
    function(e) {
        e[e.None = 0] = "None",
        e[e.Resolved = 1] = "Resolved",
        e[e.Rejected = 2] = "Rejected"
    }(n = t.PromiseState || (t.PromiseState = {}));
    var i = function() {
        function e(e) {
            var t = this;
            this.throwIfError = function() {
                if (t.isError)
                    throw t.error
            }
            ,
            e.on((function(e) {
                t.privIsCompleted || (t.privIsCompleted = !0,
                t.privIsError = !1,
                t.privResult = e)
            }
            ), (function(e) {
                t.privIsCompleted || (t.privIsCompleted = !0,
                t.privIsError = !0,
                t.privError = e)
            }
            ))
        }
        return Object.defineProperty(e.prototype, "isCompleted", {
            get: function() {
                return this.privIsCompleted
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "isError", {
            get: function() {
                return this.privIsError
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "error", {
            get: function() {
                return this.privError
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "result", {
            get: function() {
                return this.privResult
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.PromiseResult = i;
    var o = function() {
        var e = this;
        this.setResult = function(t) {
            e.privOnSetResult(t)
        }
        ,
        this.setError = function(t) {
            e.privOnSetError(t)
        }
        ,
        this.on = function(t, r) {
            e.privOnSetResult = t,
            e.privOnSetError = r
        }
    };
    t.PromiseResultEventSource = o;
    var s = function() {
        function e() {
            var e = this;
            this.resolve = function(t) {
                return e.privResolve(t),
                e
            }
            ,
            this.reject = function(t) {
                return e.privReject(t),
                e
            }
            ,
            this.privPromise = new Promise((function(t, r) {
                e.privResolve = t,
                e.privReject = r
            }
            ))
        }
        return Object.defineProperty(e.prototype, "promise", {
            get: function() {
                return this.privPromise
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.Deferred = s;
    var a = function() {
        function e() {
            var e = this;
            this.privState = n.None,
            this.privPromiseResult = null,
            this.privPromiseResultEvents = null,
            this.privSuccessHandlers = [],
            this.privErrorHandlers = [],
            this.resolve = function(t) {
                if (e.privState !== n.None)
                    throw new Error("'Cannot resolve a completed promise'");
                e.privState = n.Resolved,
                e.privPromiseResultEvents.setResult(t);
                for (var r = 0; r < e.privSuccessHandlers.length; r++)
                    e.executeSuccessCallback(t, e.privSuccessHandlers[r], e.privErrorHandlers[r]);
                e.detachHandlers()
            }
            ,
            this.reject = function(t) {
                if (e.privState !== n.None)
                    throw new Error("'Cannot reject a completed promise'");
                e.privState = n.Rejected,
                e.privPromiseResultEvents.setError(t);
                for (var r = 0, i = e.privErrorHandlers; r < i.length; r++) {
                    var o = i[r];
                    e.executeErrorCallback(t, o)
                }
                e.detachHandlers()
            }
            ,
            this.on = function(t, r) {
                null == t && (t = function(e) {}
                ),
                e.privState === n.None ? (e.privSuccessHandlers.push(t),
                e.privErrorHandlers.push(r)) : (e.privState === n.Resolved ? e.executeSuccessCallback(e.privPromiseResult.result, t, r) : e.privState === n.Rejected && e.executeErrorCallback(e.privPromiseResult.error, r),
                e.detachHandlers())
            }
            ,
            this.executeSuccessCallback = function(t, r, n) {
                try {
                    r(t)
                } catch (t) {
                    e.executeErrorCallback("'Unhandled callback error: " + t + "'", n)
                }
            }
            ,
            this.executeErrorCallback = function(e, t) {
                if (!t)
                    throw new Error("'Unhandled error: " + e + "'");
                try {
                    t(e)
                } catch (t) {
                    throw new Error("'Unhandled callback error: " + t + ". InnerError: " + e + "'")
                }
            }
            ,
            this.detachHandlers = function() {
                e.privErrorHandlers = [],
                e.privSuccessHandlers = []
            }
            ,
            this.privPromiseResultEvents = new o,
            this.privPromiseResult = new i(this.privPromiseResultEvents)
        }
        return Object.defineProperty(e.prototype, "state", {
            get: function() {
                return this.privState
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "result", {
            get: function() {
                return this.privPromiseResult
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.Sink = a,
    t.marshalPromiseToCallbacks = function(e, t, r) {
        e.then((function(e) {
            try {
                t && t(e)
            } catch (e) {
                if (r)
                    try {
                        if (e instanceof Error) {
                            var n = e;
                            r(n.name + ": " + n.message)
                        } else
                            r(e)
                    } catch (e) {}
            }
        }
        ), (function(e) {
            if (r)
                try {
                    if (e instanceof Error) {
                        var t = e;
                        r(t.name + ": " + t.message)
                    } else
                        r(e)
                } catch (e) {}
        }
        ))
    }
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
      , i = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.Queue = void 0;
    var o, s = r(25), a = r(39), c = r(40);
    !function(e) {
        e[e.Dequeue = 0] = "Dequeue",
        e[e.Peek = 1] = "Peek"
    }(o || (o = {}));
    var u = function() {
        function e(e) {
            var t = this;
            this.privPromiseStore = new a.List,
            this.privIsDrainInProgress = !1,
            this.privIsDisposing = !1,
            this.privDisposeReason = null,
            this.enqueue = function(e) {
                t.throwIfDispose(),
                t.enqueueFromPromise(new Promise((function(t, r) {
                    t(e)
                }
                )))
            }
            ,
            this.enqueueFromPromise = function(e) {
                t.throwIfDispose(),
                e.then((function(e) {
                    t.privList.add(e)
                }
                ), (function(e) {}
                ))
            }
            ,
            this.dequeue = function() {
                t.throwIfDispose();
                var e = new c.Deferred;
                return t.privSubscribers && (t.privSubscribers.add({
                    deferral: e,
                    type: o.Dequeue
                }),
                t.drain()),
                e.promise
            }
            ,
            this.peek = function() {
                t.throwIfDispose();
                var e = new c.Deferred;
                return t.privSubscribers && (t.privSubscribers.add({
                    deferral: e,
                    type: o.Peek
                }),
                t.drain()),
                e.promise
            }
            ,
            this.length = function() {
                return t.throwIfDispose(),
                t.privList.length()
            }
            ,
            this.isDisposed = function() {
                return null == t.privSubscribers
            }
            ,
            this.drain = function() {
                if (!t.privIsDrainInProgress && !t.privIsDisposing) {
                    t.privIsDrainInProgress = !0;
                    var e = t.privSubscribers
                      , r = t.privList;
                    if (e && r) {
                        for (; r.length() > 0 && e.length() > 0 && !t.privIsDisposing; ) {
                            var n = e.removeFirst();
                            if (n.type === o.Peek)
                                n.deferral.resolve(r.first());
                            else {
                                var i = r.removeFirst();
                                n.deferral.resolve(i)
                            }
                        }
                        t.privSubscribers === e && (t.privSubscribers = e),
                        t.privList === r && (t.privList = r)
                    }
                    t.privIsDrainInProgress = !1
                }
            }
            ,
            this.throwIfDispose = function() {
                if (t.isDisposed()) {
                    if (t.privDisposeReason)
                        throw new s.InvalidOperationError(t.privDisposeReason);
                    throw new s.ObjectDisposedError("Queue")
                }
                if (t.privIsDisposing)
                    throw new s.InvalidOperationError("Queue disposing")
            }
            ,
            this.privList = e || new a.List,
            this.privDetachables = [],
            this.privSubscribers = new a.List,
            this.privDetachables.push(this.privList.onAdded(this.drain))
        }
        return e.prototype.drainAndDispose = function(e, t) {
            return n(this, void 0, void 0, (function() {
                var r, n, o, s, a = this;
                return i(this, (function(i) {
                    switch (i.label) {
                    case 0:
                        if (this.isDisposed() || this.privIsDisposing)
                            return [3, 5];
                        if (this.privDisposeReason = t,
                        this.privIsDisposing = !0,
                        r = this.privSubscribers) {
                            for (; r.length() > 0; )
                                r.removeFirst().deferral.resolve(void 0);
                            this.privSubscribers === r && (this.privSubscribers = r)
                        }
                        n = 0,
                        o = this.privDetachables,
                        i.label = 1;
                    case 1:
                        return n < o.length ? [4, o[n].detach()] : [3, 4];
                    case 2:
                        i.sent(),
                        i.label = 3;
                    case 3:
                        return n++,
                        [3, 1];
                    case 4:
                        if (this.privPromiseStore.length() > 0 && e)
                            return s = [],
                            this.privPromiseStore.toArray().forEach((function(e) {
                                s.push(e)
                            }
                            )),
                            [2, Promise.all(s).finally((function() {
                                a.privSubscribers = null,
                                a.privList.forEach((function(t, r) {
                                    e(t)
                                }
                                )),
                                a.privList = null
                            }
                            )).then()];
                        this.privSubscribers = null,
                        this.privList = null,
                        i.label = 5;
                    case 5:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.dispose = function(e) {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return [4, this.drainAndDispose(null, e)];
                    case 1:
                        return t.sent(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e
    }();
    t.Queue = u
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.RawWebsocketMessage = void 0;
    var n = r(24)
      , i = r(25)
      , o = r(7)
      , s = function() {
        function e(e, t, r) {
            if (this.privPayload = null,
            !t)
                throw new i.ArgumentNullError("payload");
            if (e === n.MessageType.Binary && "ArrayBuffer" !== t.__proto__.constructor.name)
                throw new i.InvalidOperationError("Payload must be ArrayBuffer");
            if (e === n.MessageType.Text && "string" != typeof t)
                throw new i.InvalidOperationError("Payload must be a string");
            this.privMessageType = e,
            this.privPayload = t,
            this.privId = r || o.createNoDashGuid()
        }
        return Object.defineProperty(e.prototype, "messageType", {
            get: function() {
                return this.privMessageType
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "payload", {
            get: function() {
                return this.privPayload
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "textContent", {
            get: function() {
                if (this.privMessageType === n.MessageType.Binary)
                    throw new i.InvalidOperationError("Not supported for binary message");
                return this.privPayload
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "binaryContent", {
            get: function() {
                if (this.privMessageType === n.MessageType.Text)
                    throw new i.InvalidOperationError("Not supported for text message");
                return this.privPayload
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "id", {
            get: function() {
                return this.privId
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.RawWebsocketMessage = s
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.RiffPcmEncoder = void 0;
    var n = function(e, t) {
        var r = this;
        this.encode = function(e) {
            var t = r.downSampleAudioFrame(e, r.privActualSampleRate, r.privDesiredSampleRate);
            if (!t)
                return null;
            var n = 2 * t.length
              , i = new ArrayBuffer(n)
              , o = new DataView(i);
            return r.floatTo16BitPCM(o, 0, t),
            i
        }
        ,
        this.setString = function(e, t, r) {
            for (var n = 0; n < r.length; n++)
                e.setUint8(t + n, r.charCodeAt(n))
        }
        ,
        this.floatTo16BitPCM = function(e, t, r) {
            for (var n = 0; n < r.length; n++,
            t += 2) {
                var i = Math.max(-1, Math.min(1, r[n]));
                e.setInt16(t, i < 0 ? 32768 * i : 32767 * i, !0)
            }
        }
        ,
        this.downSampleAudioFrame = function(e, t, r) {
            if (!e)
                return null;
            if (r === t || r > t)
                return e;
            for (var n = t / r, i = Math.round(e.length / n), o = new Float32Array(i), s = 0, a = 0; a < i; ) {
                for (var c = Math.round((a + 1) * n), u = 0, p = 0; s < c && s < e.length; )
                    u += e[s++],
                    p++;
                o[a++] = u / p
            }
            return o
        }
        ,
        this.privActualSampleRate = e,
        this.privDesiredSampleRate = t
    };
    t.RiffPcmEncoder = n
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
      , i = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.Stream = void 0;
    var o = r(25)
      , s = r(7)
      , a = r(41)
      , c = function() {
        function e(e) {
            var t = this;
            this.privIsWriteEnded = !1,
            this.privIsReadEnded = !1,
            this.read = function() {
                if (t.privIsReadEnded)
                    throw new o.InvalidOperationError("Stream read has already finished");
                return t.privReaderQueue.dequeue().then((function(e) {
                    return n(t, void 0, void 0, (function() {
                        return i(this, (function(t) {
                            switch (t.label) {
                            case 0:
                                return void 0 === e || e.isEnd ? [4, this.privReaderQueue.dispose("End of stream reached")] : [3, 2];
                            case 1:
                                t.sent(),
                                t.label = 2;
                            case 2:
                                return [2, e]
                            }
                        }
                        ))
                    }
                    ))
                }
                ))
            }
            ,
            this.readEnded = function() {
                t.privIsReadEnded || (t.privIsReadEnded = !0,
                t.privReaderQueue = new a.Queue)
            }
            ,
            this.throwIfClosed = function() {
                if (t.privIsWriteEnded)
                    throw new o.InvalidOperationError("Stream closed")
            }
            ,
            this.privId = e || s.createNoDashGuid(),
            this.privReaderQueue = new a.Queue
        }
        return Object.defineProperty(e.prototype, "isClosed", {
            get: function() {
                return this.privIsWriteEnded
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "isReadEnded", {
            get: function() {
                return this.privIsReadEnded
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "id", {
            get: function() {
                return this.privId
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.close = function() {
            this.privIsWriteEnded || (this.writeStreamChunk({
                buffer: null,
                isEnd: !0,
                timeReceived: Date.now()
            }),
            this.privIsWriteEnded = !0)
        }
        ,
        e.prototype.writeStreamChunk = function(e) {
            if (this.throwIfClosed(),
            !this.privReaderQueue.isDisposed())
                try {
                    this.privReaderQueue.enqueue(e)
                } catch (e) {}
        }
        ,
        e
    }();
    t.Stream = c
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.TranslationStatus = void 0,
    function(e) {
        e[e.Success = 0] = "Success",
        e[e.Error = 1] = "Error"
    }(t.TranslationStatus || (t.TranslationStatus = {}))
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ChunkedArrayBufferStream = void 0;
    var o = function(e) {
        function t(t, r) {
            var n = e.call(this, r) || this;
            return n.privTargetChunkSize = t,
            n.privNextBufferReadyBytes = 0,
            n
        }
        return i(t, e),
        t.prototype.writeStreamChunk = function(t) {
            if (t.isEnd || 0 === this.privNextBufferReadyBytes && t.buffer.byteLength === this.privTargetChunkSize)
                e.prototype.writeStreamChunk.call(this, t);
            else
                for (var r = 0; r < t.buffer.byteLength; ) {
                    void 0 === this.privNextBufferToWrite && (this.privNextBufferToWrite = new ArrayBuffer(this.privTargetChunkSize),
                    this.privNextBufferStartTime = t.timeReceived);
                    var n = Math.min(t.buffer.byteLength - r, this.privTargetChunkSize - this.privNextBufferReadyBytes)
                      , i = new Uint8Array(this.privNextBufferToWrite)
                      , o = new Uint8Array(t.buffer.slice(r, n + r));
                    i.set(o, this.privNextBufferReadyBytes),
                    this.privNextBufferReadyBytes += n,
                    r += n,
                    this.privNextBufferReadyBytes === this.privTargetChunkSize && (e.prototype.writeStreamChunk.call(this, {
                        buffer: this.privNextBufferToWrite,
                        isEnd: !1,
                        timeReceived: this.privNextBufferStartTime
                    }),
                    this.privNextBufferReadyBytes = 0,
                    this.privNextBufferToWrite = void 0)
                }
        }
        ,
        t.prototype.close = function() {
            0 === this.privNextBufferReadyBytes || this.isClosed || e.prototype.writeStreamChunk.call(this, {
                buffer: this.privNextBufferToWrite.slice(0, this.privNextBufferReadyBytes),
                isEnd: !1,
                timeReceived: this.privNextBufferStartTime
            }),
            e.prototype.close.call(this)
        }
        ,
        t
    }(r(4).Stream);
    t.ChunkedArrayBufferStream = o
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    })
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.Timeout = void 0;
    var n = function() {
        function e() {}
        return e.workerTimers = null,
        e.clearTimeout = function(t) {
            return e.timers().clearTimeout(t)
        }
        ,
        e.setTimeout = function(t, r) {
            return e.timers().setTimeout(t, r)
        }
        ,
        e.load = function(t) {
            var r = new Map([[0, function() {}
            ]])
              , n = new Map
              , i = new Worker(t);
            i.addEventListener("message", (function(t) {
                var i = t.data;
                if (e.isCallNotification(i)) {
                    var o = i.params.timerId
                      , s = r.get(o);
                    if ("number" == typeof s) {
                        if (void 0 === (c = n.get(s)) || c !== o)
                            throw new Error("The timer is in an undefined state.")
                    } else {
                        if (void 0 === s)
                            throw new Error("The timer is in an undefined state.");
                        s(),
                        r.delete(o)
                    }
                } else {
                    if (!e.isClearResponse(i)) {
                        var a = i.error.message;
                        throw new Error(a)
                    }
                    var c, u = i.id;
                    if (void 0 === (c = n.get(u)))
                        throw new Error("The timer is in an undefined state.");
                    n.delete(u),
                    r.delete(c)
                }
            }
            ));
            return {
                clearTimeout: function(e) {
                    var t = Math.random();
                    n.set(t, e),
                    r.set(e, t),
                    i.postMessage({
                        id: t,
                        method: "clear",
                        params: {
                            timerId: e
                        }
                    })
                },
                setTimeout: function(e, t) {
                    var n = Math.random();
                    return r.set(n, e),
                    i.postMessage({
                        id: null,
                        method: "set",
                        params: {
                            delay: t,
                            now: performance.now(),
                            timerId: n
                        }
                    }),
                    n
                }
            }
        }
        ,
        e.loadWorkerTimers = function() {
            return function() {
                if (null !== e.workerTimers)
                    return e.workerTimers;
                var t = new Blob(['!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=14)}([function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return u})),n.d(t,"c",(function(){return a})),n.d(t,"d",(function(){return d}));const r=new Map,o=new Map,i=e=>{const t=r.get(e);if(void 0===t)throw new Error(\'There is no interval scheduled with the given id "\'.concat(e,\'".\'));clearTimeout(t),r.delete(e)},u=e=>{const t=o.get(e);if(void 0===t)throw new Error(\'There is no timeout scheduled with the given id "\'.concat(e,\'".\'));clearTimeout(t),o.delete(e)},f=(e,t)=>{let n,r;if("performance"in self){const o=performance.now();n=o,r=e-Math.max(0,o-t)}else n=Date.now(),r=e;return{expected:n+r,remainingDelay:r}},c=(e,t,n,r)=>{const o="performance"in self?performance.now():Date.now();o>n?postMessage({id:null,method:"call",params:{timerId:t}}):e.set(t,setTimeout(c,n-o,e,t,n))},a=(e,t,n)=>{const{expected:o,remainingDelay:i}=f(e,n);r.set(t,setTimeout(c,i,r,t,o))},d=(e,t,n)=>{const{expected:r,remainingDelay:i}=f(e,n);o.set(t,setTimeout(c,i,o,t,r))}},function(e,t,n){"use strict";n.r(t);var r=n(2);for(var o in r)"default"!==o&&function(e){n.d(t,e,(function(){return r[e]}))}(o);var i=n(3);for(var o in i)"default"!==o&&function(e){n.d(t,e,(function(){return i[e]}))}(o);var u=n(4);for(var o in u)"default"!==o&&function(e){n.d(t,e,(function(){return u[e]}))}(o);var f=n(5);for(var o in f)"default"!==o&&function(e){n.d(t,e,(function(){return f[e]}))}(o);var c=n(6);for(var o in c)"default"!==o&&function(e){n.d(t,e,(function(){return c[e]}))}(o);var a=n(7);for(var o in a)"default"!==o&&function(e){n.d(t,e,(function(){return a[e]}))}(o);var d=n(8);for(var o in d)"default"!==o&&function(e){n.d(t,e,(function(){return d[e]}))}(o);var s=n(9);for(var o in s)"default"!==o&&function(e){n.d(t,e,(function(){return s[e]}))}(o)},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,n){"use strict";n.r(t);var r=n(11);for(var o in r)"default"!==o&&function(e){n.d(t,e,(function(){return r[e]}))}(o);var i=n(12);for(var o in i)"default"!==o&&function(e){n.d(t,e,(function(){return i[e]}))}(o);var u=n(13);for(var o in u)"default"!==o&&function(e){n.d(t,e,(function(){return u[e]}))}(o)},function(e,t){},function(e,t){},function(e,t){},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n(1);for(var i in o)"default"!==i&&function(e){n.d(t,e,(function(){return o[e]}))}(i);var u=n(10);for(var i in u)"default"!==i&&function(e){n.d(t,e,(function(){return u[e]}))}(i);addEventListener("message",({data:e})=>{try{if("clear"===e.method){const{id:t,params:{timerId:n}}=e;Object(r.b)(n),postMessage({error:null,id:t})}else{if("set"!==e.method)throw new Error(\'The given method "\'.concat(e.method,\'" is not supported\'));{const{params:{delay:t,now:n,timerId:o}}=e;Object(r.d)(t,o,n)}}}catch(t){postMessage({error:{message:t.message},id:e.id,result:null})}})}]);'],{
                    type: "application/javascript; charset=utf-8"
                })
                  , r = URL.createObjectURL(t);
                return e.workerTimers = e.load(r),
                e.workerTimers.setTimeout((function() {
                    return URL.revokeObjectURL(r)
                }
                ), 0),
                e.workerTimers
            }
        }
        ,
        e.timers = e.loadWorkerTimers(),
        e.isCallNotification = function(e) {
            return void 0 !== e.method && "call" === e.method
        }
        ,
        e.isClearResponse = function(e) {
            return null === e.error && "number" == typeof e.id
        }
        ,
        e
    }();
    t.Timeout = n
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.OCSPCacheUpdateErrorEvent = t.OCSPResponseRetrievedEvent = t.OCSPCacheFetchErrorEvent = t.OCSPVerificationFailedEvent = t.OCSPCacheHitEvent = t.OCSPCacheEntryNeedsRefreshEvent = t.OCSPCacheEntryExpiredEvent = t.OCSPWSUpgradeStartedEvent = t.OCSPStapleReceivedEvent = t.OCSPCacheUpdatehCompleteEvent = t.OCSPDiskCacheStoreEvent = t.OCSPMemoryCacheStoreEvent = t.OCSPCacheUpdateNeededEvent = t.OCSPDiskCacheHitEvent = t.OCSPCacheMissEvent = t.OCSPMemoryCacheHitEvent = t.OCSPEvent = void 0;
    var o = r(6)
      , s = function(e) {
        function t(t, r, n) {
            var i = e.call(this, t, r) || this;
            return i.privSignature = n,
            i
        }
        return i(t, e),
        t
    }(o.PlatformEvent);
    t.OCSPEvent = s;
    var a = function(e) {
        function t(t) {
            return e.call(this, "OCSPMemoryCacheHitEvent", o.EventType.Debug, t) || this
        }
        return i(t, e),
        t
    }(s);
    t.OCSPMemoryCacheHitEvent = a;
    var c = function(e) {
        function t(t) {
            return e.call(this, "OCSPCacheMissEvent", o.EventType.Debug, t) || this
        }
        return i(t, e),
        t
    }(s);
    t.OCSPCacheMissEvent = c;
    var u = function(e) {
        function t(t) {
            return e.call(this, "OCSPDiskCacheHitEvent", o.EventType.Debug, t) || this
        }
        return i(t, e),
        t
    }(s);
    t.OCSPDiskCacheHitEvent = u;
    var p = function(e) {
        function t(t) {
            return e.call(this, "OCSPCacheUpdateNeededEvent", o.EventType.Debug, t) || this
        }
        return i(t, e),
        t
    }(s);
    t.OCSPCacheUpdateNeededEvent = p;
    var l = function(e) {
        function t(t) {
            return e.call(this, "OCSPMemoryCacheStoreEvent", o.EventType.Debug, t) || this
        }
        return i(t, e),
        t
    }(s);
    t.OCSPMemoryCacheStoreEvent = l;
    var f = function(e) {
        function t(t) {
            return e.call(this, "OCSPDiskCacheStoreEvent", o.EventType.Debug, t) || this
        }
        return i(t, e),
        t
    }(s);
    t.OCSPDiskCacheStoreEvent = f;
    var h = function(e) {
        function t(t) {
            return e.call(this, "OCSPCacheUpdatehCompleteEvent", o.EventType.Debug, t) || this
        }
        return i(t, e),
        t
    }(s);
    t.OCSPCacheUpdatehCompleteEvent = h;
    var v = function(e) {
        function t() {
            return e.call(this, "OCSPStapleReceivedEvent", o.EventType.Debug, "") || this
        }
        return i(t, e),
        t
    }(s);
    t.OCSPStapleReceivedEvent = v;
    var d = function(e) {
        function t(t) {
            return e.call(this, "OCSPWSUpgradeStartedEvent", o.EventType.Debug, t) || this
        }
        return i(t, e),
        t
    }(s);
    t.OCSPWSUpgradeStartedEvent = d;
    var y = function(e) {
        function t(t, r) {
            var n = e.call(this, "OCSPCacheEntryExpiredEvent", o.EventType.Debug, t) || this;
            return n.privExpireTime = r,
            n
        }
        return i(t, e),
        t
    }(s);
    t.OCSPCacheEntryExpiredEvent = y;
    var g = function(e) {
        function t(t, r, n) {
            var i = e.call(this, "OCSPCacheEntryNeedsRefreshEvent", o.EventType.Debug, t) || this;
            return i.privExpireTime = n,
            i.privStartTime = r,
            i
        }
        return i(t, e),
        t
    }(s);
    t.OCSPCacheEntryNeedsRefreshEvent = g;
    var m = function(e) {
        function t(t, r, n) {
            var i = e.call(this, "OCSPCacheHitEvent", o.EventType.Debug, t) || this;
            return i.privExpireTime = n,
            i.privExpireTimeString = new Date(n).toLocaleDateString(),
            i.privStartTime = r,
            i.privStartTimeString = new Date(r).toLocaleTimeString(),
            i
        }
        return i(t, e),
        t
    }(s);
    t.OCSPCacheHitEvent = m;
    var b = function(e) {
        function t(t, r) {
            var n = e.call(this, "OCSPVerificationFailedEvent", o.EventType.Debug, t) || this;
            return n.privError = r,
            n
        }
        return i(t, e),
        t
    }(s);
    t.OCSPVerificationFailedEvent = b;
    var S = function(e) {
        function t(t, r) {
            var n = e.call(this, "OCSPCacheFetchErrorEvent", o.EventType.Debug, t) || this;
            return n.privError = r,
            n
        }
        return i(t, e),
        t
    }(s);
    t.OCSPCacheFetchErrorEvent = S;
    var C = function(e) {
        function t(t) {
            return e.call(this, "OCSPResponseRetrievedEvent", o.EventType.Debug, t) || this
        }
        return i(t, e),
        t
    }(s);
    t.OCSPResponseRetrievedEvent = C;
    var P = function(e) {
        function t(t, r) {
            var n = e.call(this, "OCSPCacheUpdateErrorEvent", o.EventType.Debug, t) || this;
            return n.privError = r,
            n
        }
        return i(t, e),
        t
    }(s);
    t.OCSPCacheUpdateErrorEvent = P
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.BackgroundEvent = void 0;
    var o = r(4)
      , s = function(e) {
        function t(t) {
            var r = e.call(this, "BackgroundEvent", o.EventType.Error) || this;
            return r.privError = t,
            r
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "error", {
            get: function() {
                return this.privError
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(o.PlatformEvent);
    t.BackgroundEvent = s
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    })
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
      , i = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.MicAudioSource = t.AudioWorkletSourceURLPropertyName = void 0;
    var o = r(53)
      , s = r(4)
      , a = r(72);
    t.AudioWorkletSourceURLPropertyName = "MICROPHONE-WorkletSourceUrl";
    var c = function() {
        function e(t, r, o, c) {
            var u = this;
            this.privRecorder = t,
            this.deviceId = r,
            this.privStreams = {},
            this.turnOn = function() {
                if (u.privInitializeDeferral)
                    return u.privInitializeDeferral.promise;
                u.privInitializeDeferral = new s.Deferred;
                try {
                    u.createAudioContext()
                } catch (t) {
                    if (t instanceof Error) {
                        var e = t;
                        u.privInitializeDeferral.reject(e.name + ": " + e.message)
                    } else
                        u.privInitializeDeferral.reject(t);
                    return u.privInitializeDeferral.promise
                }
                var t = window.navigator
                  , r = t.getUserMedia || t.webkitGetUserMedia || t.mozGetUserMedia || t.msGetUserMedia;
                if (t.mediaDevices && (r = function(e, r, n) {
                    t.mediaDevices.getUserMedia(e).then(r).catch(n)
                }
                ),
                r) {
                    var n = function() {
                        u.onEvent(new s.AudioSourceInitializingEvent(u.privId)),
                        u.privMediaStream && u.privMediaStream.active ? (u.onEvent(new s.AudioSourceReadyEvent(u.privId)),
                        u.privInitializeDeferral.resolve()) : r({
                            audio: !u.deviceId || {
                                deviceId: u.deviceId
                            },
                            video: !1
                        }, (function(e) {
                            u.privMediaStream = e,
                            u.onEvent(new s.AudioSourceReadyEvent(u.privId)),
                            u.privInitializeDeferral.resolve()
                        }
                        ), (function(e) {
                            var t = "Error occurred during microphone initialization: " + e;
                            u.privInitializeDeferral.reject(t),
                            u.onEvent(new s.AudioSourceErrorEvent(u.privId,t))
                        }
                        ))
                    };
                    "suspended" === u.privContext.state ? u.privContext.resume().then(n).catch((function(e) {
                        u.privInitializeDeferral.reject("Failed to initialize audio context: " + e)
                    }
                    )) : n()
                } else {
                    var i = "Browser does not support getUserMedia.";
                    u.privInitializeDeferral.reject(i),
                    u.onEvent(new s.AudioSourceErrorEvent(i,""))
                }
                return u.privInitializeDeferral.promise
            }
            ,
            this.id = function() {
                return u.privId
            }
            ,
            this.attach = function(e) {
                return u.onEvent(new s.AudioStreamNodeAttachingEvent(u.privId,e)),
                u.listen(e).then((function(t) {
                    return u.onEvent(new s.AudioStreamNodeAttachedEvent(u.privId,e)),
                    {
                        detach: function() {
                            return n(u, void 0, void 0, (function() {
                                return i(this, (function(r) {
                                    return t.readEnded(),
                                    delete this.privStreams[e],
                                    this.onEvent(new s.AudioStreamNodeDetachedEvent(this.privId,e)),
                                    [2, this.turnOff()]
                                }
                                ))
                            }
                            ))
                        },
                        id: function() {
                            return e
                        },
                        read: function() {
                            return t.read()
                        }
                    }
                }
                ))
            }
            ,
            this.detach = function(e) {
                e && u.privStreams[e] && (u.privStreams[e].close(),
                delete u.privStreams[e],
                u.onEvent(new s.AudioStreamNodeDetachedEvent(u.privId,e)))
            }
            ,
            this.listen = function(e) {
                return n(u, void 0, void 0, (function() {
                    var t;
                    return i(this, (function(r) {
                        switch (r.label) {
                        case 0:
                            return [4, this.turnOn()];
                        case 1:
                            r.sent(),
                            t = new s.ChunkedArrayBufferStream(this.privOutputChunkSize,e),
                            this.privStreams[e] = t;
                            try {
                                this.privRecorder.record(this.privContext, this.privMediaStream, t)
                            } catch (t) {
                                throw this.onEvent(new s.AudioStreamNodeErrorEvent(this.privId,e,t)),
                                t
                            }
                            return [2, t]
                        }
                    }
                    ))
                }
                ))
            }
            ,
            this.onEvent = function(e) {
                u.privEvents.onEvent(e),
                s.Events.instance.onEvent(e)
            }
            ,
            this.createAudioContext = function() {
                u.privContext || (u.privContext = a.AudioStreamFormatImpl.getAudioContext(e.AUDIOFORMAT.samplesPerSec))
            }
            ,
            this.privOutputChunkSize = e.AUDIOFORMAT.avgBytesPerSec / 10,
            this.privId = o || s.createNoDashGuid(),
            this.privEvents = new s.EventSource,
            this.privMediaStream = c || null,
            this.privIsClosing = !1
        }
        return Object.defineProperty(e.prototype, "format", {
            get: function() {
                return Promise.resolve(e.AUDIOFORMAT)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "blob", {
            get: function() {
                return Promise.reject("Not implemented for Mic input")
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.turnOff = function() {
            return n(this, void 0, void 0, (function() {
                var e, t;
                return i(this, (function(r) {
                    switch (r.label) {
                    case 0:
                        for (e in this.privStreams)
                            e && (t = this.privStreams[e]) && t.close();
                        return this.onEvent(new s.AudioSourceOffEvent(this.privId)),
                        this.privInitializeDeferral ? [4, this.privInitializeDeferral] : [3, 2];
                    case 1:
                        r.sent(),
                        this.privInitializeDeferral = null,
                        r.label = 2;
                    case 2:
                        return [4, this.destroyAudioContext()];
                    case 3:
                        return r.sent(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        Object.defineProperty(e.prototype, "events", {
            get: function() {
                return this.privEvents
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "deviceInfo", {
            get: function() {
                return this.getMicrophoneLabel().then((function(t) {
                    return {
                        bitspersample: e.AUDIOFORMAT.bitsPerSample,
                        channelcount: e.AUDIOFORMAT.channels,
                        connectivity: o.connectivity.Unknown,
                        manufacturer: "Speech SDK",
                        model: t,
                        samplerate: e.AUDIOFORMAT.samplesPerSec,
                        type: o.type.Microphones
                    }
                }
                ))
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.setProperty = function(e, r) {
            if (e !== t.AudioWorkletSourceURLPropertyName)
                throw new Error("Property '" + e + "' is not supported on Microphone.");
            this.privRecorder.setWorkletUrl(r)
        }
        ,
        e.prototype.getMicrophoneLabel = function() {
            var e = this
              , t = "microphone";
            if (void 0 !== this.privMicrophoneLabel)
                return Promise.resolve(this.privMicrophoneLabel);
            if (void 0 === this.privMediaStream || !this.privMediaStream.active)
                return Promise.resolve(t);
            this.privMicrophoneLabel = t;
            var r = this.privMediaStream.getTracks()[0].getSettings().deviceId;
            if (void 0 === r)
                return Promise.resolve(this.privMicrophoneLabel);
            var n = new s.Deferred;
            return navigator.mediaDevices.enumerateDevices().then((function(t) {
                for (var i = 0, o = t; i < o.length; i++) {
                    var s = o[i];
                    if (s.deviceId === r) {
                        e.privMicrophoneLabel = s.label;
                        break
                    }
                }
                n.resolve(e.privMicrophoneLabel)
            }
            ), (function() {
                return n.resolve(e.privMicrophoneLabel)
            }
            )),
            n.promise
        }
        ,
        e.prototype.destroyAudioContext = function() {
            return n(this, void 0, void 0, (function() {
                var e;
                return i(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return this.privContext ? (this.privRecorder.releaseMediaResources(this.privContext),
                        e = !1,
                        "close"in this.privContext && (e = !0),
                        e ? this.privIsClosing ? [3, 2] : (this.privIsClosing = !0,
                        [4, this.privContext.close()]) : [3, 3]) : [2];
                    case 1:
                        t.sent(),
                        this.privContext = null,
                        this.privIsClosing = !1,
                        t.label = 2;
                    case 2:
                        return [3, 5];
                    case 3:
                        return null === this.privContext || "running" !== this.privContext.state ? [3, 5] : [4, this.privContext.suspend()];
                    case 4:
                        t.sent(),
                        t.label = 5;
                    case 5:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.AUDIOFORMAT = a.AudioStreamFormat.getDefaultInputFormat(),
        e
    }();
    t.MicAudioSource = c
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__createBinding || (Object.create ? function(e, t, r, n) {
        void 0 === n && (n = r),
        Object.defineProperty(e, n, {
            enumerable: !0,
            get: function() {
                return t[r]
            }
        })
    }
    : function(e, t, r, n) {
        void 0 === n && (n = r),
        e[n] = t[r]
    }
    )
      , i = this && this.__exportStar || function(e, t) {
        for (var r in e)
            "default" === r || t.hasOwnProperty(r) || n(t, e, r)
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.AutoDetectSourceLanguagesOpenRangeOptionName = t.ForceDictationPropertyName = t.ServicePropertiesPropertyName = t.CancellationErrorCodePropertyName = t.OutputFormatPropertyName = void 0,
    i(r(54), t),
    i(r(57), t),
    i(r(56), t),
    i(r(58), t),
    i(r(59), t),
    i(r(60), t),
    i(r(168), t),
    i(r(169), t),
    i(r(171), t),
    i(r(172), t),
    i(r(173), t),
    i(r(174), t),
    i(r(175), t),
    i(r(176), t),
    i(r(177), t),
    i(r(178), t),
    i(r(179), t),
    i(r(180), t),
    i(r(181), t),
    i(r(182), t),
    i(r(183), t),
    i(r(184), t),
    i(r(185), t),
    i(r(186), t),
    i(r(187), t),
    i(r(188), t),
    i(r(189), t),
    i(r(190), t),
    i(r(191), t),
    i(r(192), t),
    i(r(193), t),
    i(r(194), t),
    i(r(196), t),
    i(r(197), t),
    i(r(198), t),
    i(r(199), t),
    i(r(203), t),
    i(r(204), t),
    i(r(221), t),
    i(r(222), t),
    i(r(223), t),
    i(r(225), t),
    i(r(226), t),
    i(r(227), t),
    i(r(228), t),
    t.OutputFormatPropertyName = "OutputFormat",
    t.CancellationErrorCodePropertyName = "CancellationErrorCode",
    t.ServicePropertiesPropertyName = "ServiceProperties",
    t.ForceDictationPropertyName = "ForceDictation",
    t.AutoDetectSourceLanguagesOpenRangeOptionName = "OpenRange"
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.CognitiveSubscriptionKeyAuthentication = void 0;
    var n = r(4)
      , i = r(55)
      , o = r(56)
      , s = function(e) {
        var t = this;
        if (this.fetch = function(e) {
            return Promise.resolve(t.privAuthInfo)
        }
        ,
        this.fetchOnExpiry = function(e) {
            return Promise.resolve(t.privAuthInfo)
        }
        ,
        !e)
            throw new n.ArgumentNullError("subscriptionKey");
        this.privAuthInfo = new o.AuthInfo(i.HeaderNames.AuthKey,e)
    };
    t.CognitiveSubscriptionKeyAuthentication = s
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.HeaderNames = void 0;
    var n = function() {
        function e() {}
        return e.AuthKey = "Ocp-Apim-Subscription-Key",
        e.ConnectionId = "X-ConnectionId",
        e.ContentType = "Content-Type",
        e.CustomCommandsAppId = "X-CommandsAppId",
        e.Path = "Path",
        e.RequestId = "X-RequestId",
        e.RequestStreamId = "X-StreamId",
        e.RequestTimestamp = "X-Timestamp",
        e
    }();
    t.HeaderNames = n
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.AuthInfo = void 0;
    var n = function() {
        function e(e, t) {
            this.privHeaderName = e,
            this.privToken = t
        }
        return Object.defineProperty(e.prototype, "headerName", {
            get: function() {
                return this.privHeaderName
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "token", {
            get: function() {
                return this.privToken
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.AuthInfo = n
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.CognitiveTokenAuthentication = void 0;
    var n = r(4)
      , i = r(56)
      , o = "Authorization"
      , s = function() {
        function e(t, r) {
            var s = this;
            if (this.fetch = function(t) {
                return s.privFetchCallback(t).then((function(t) {
                    return new i.AuthInfo(o,e.privTokenPrefix + t)
                }
                ))
            }
            ,
            this.fetchOnExpiry = function(t) {
                return s.privFetchOnExpiryCallback(t).then((function(t) {
                    return new i.AuthInfo(o,e.privTokenPrefix + t)
                }
                ))
            }
            ,
            !t)
                throw new n.ArgumentNullError("fetchCallback");
            if (!r)
                throw new n.ArgumentNullError("fetchOnExpiryCallback");
            this.privFetchCallback = t,
            this.privFetchOnExpiryCallback = r
        }
        return e.privTokenPrefix = "bearer ",
        e
    }();
    t.CognitiveTokenAuthentication = s
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    })
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    })
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.IntentConnectionFactory = void 0;
    var o = r(2)
      , s = r(61)
      , a = r(123)
      , c = r(53)
      , u = r(55)
      , p = function(e) {
        function t() {
            var t = null !== e && e.apply(this, arguments) || this;
            return t.create = function(e, r, n) {
                var i = e.parameters.getProperty(s.PropertyId.SpeechServiceConnection_Endpoint);
                if (!i) {
                    var p = e.parameters.getProperty(s.PropertyId.SpeechServiceConnection_IntentRegion)
                      , l = a.ConnectionFactoryBase.getHostSuffix(p);
                    i = e.parameters.getProperty(s.PropertyId.SpeechServiceConnection_Host, "wss://" + p + ".sr.speech" + l) + "/speech/recognition/interactive/cognitiveservices/v1"
                }
                var f = {
                    format: "simple",
                    language: e.parameters.getProperty(s.PropertyId.SpeechServiceConnection_RecoLanguage)
                };
                t.setCommonUrlParams(e, f, i);
                var h = {};
                void 0 !== r.token && "" !== r.token && (h[r.headerName] = r.token),
                h[u.HeaderNames.ConnectionId] = n,
                e.parameters.setProperty(s.PropertyId.SpeechServiceConnection_Url, i);
                var v = "true" === e.parameters.getProperty("SPEECH-EnableWebsocketCompression", "false");
                return new o.WebsocketConnection(i,f,h,new c.WebsocketMessageFormatter,o.ProxyInfo.fromRecognizerConfig(e),v,n)
            }
            ,
            t
        }
        return i(t, e),
        t.prototype.getSpeechRegionFromIntentRegion = function(e) {
            switch (e) {
            case "West US":
            case "US West":
            case "westus":
                return "uswest";
            case "West US 2":
            case "US West 2":
            case "westus2":
                return "uswest2";
            case "South Central US":
            case "US South Central":
            case "southcentralus":
                return "ussouthcentral";
            case "West Central US":
            case "US West Central":
            case "westcentralus":
                return "uswestcentral";
            case "East US":
            case "US East":
            case "eastus":
                return "useast";
            case "East US 2":
            case "US East 2":
            case "eastus2":
                return "useast2";
            case "West Europe":
            case "Europe West":
            case "westeurope":
                return "europewest";
            case "North Europe":
            case "Europe North":
            case "northeurope":
                return "europenorth";
            case "Brazil South":
            case "South Brazil":
            case "southbrazil":
                return "brazilsouth";
            case "Australia East":
            case "East Australia":
            case "eastaustralia":
                return "australiaeast";
            case "Southeast Asia":
            case "Asia Southeast":
            case "southeastasia":
                return "asiasoutheast";
            case "East Asia":
            case "Asia East":
            case "eastasia":
                return "asiaeast";
            default:
                return e
            }
        }
        ,
        t
    }(a.ConnectionFactoryBase);
    t.IntentConnectionFactory = p
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    });
    var n = r(62);
    Object.defineProperty(t, "AudioConfig", {
        enumerable: !0,
        get: function() {
            return n.AudioConfig
        }
    });
    var i = r(72);
    Object.defineProperty(t, "AudioStreamFormat", {
        enumerable: !0,
        get: function() {
            return i.AudioStreamFormat
        }
    });
    var o = r(66);
    Object.defineProperty(t, "AudioInputStream", {
        enumerable: !0,
        get: function() {
            return o.AudioInputStream
        }
    }),
    Object.defineProperty(t, "PullAudioInputStream", {
        enumerable: !0,
        get: function() {
            return o.PullAudioInputStream
        }
    }),
    Object.defineProperty(t, "PushAudioInputStream", {
        enumerable: !0,
        get: function() {
            return o.PushAudioInputStream
        }
    });
    var s = r(73);
    Object.defineProperty(t, "AudioOutputStream", {
        enumerable: !0,
        get: function() {
            return s.AudioOutputStream
        }
    }),
    Object.defineProperty(t, "PullAudioOutputStream", {
        enumerable: !0,
        get: function() {
            return s.PullAudioOutputStream
        }
    }),
    Object.defineProperty(t, "PushAudioOutputStream", {
        enumerable: !0,
        get: function() {
            return s.PushAudioOutputStream
        }
    });
    var a = r(76);
    Object.defineProperty(t, "CancellationReason", {
        enumerable: !0,
        get: function() {
            return a.CancellationReason
        }
    });
    var c = r(77);
    Object.defineProperty(t, "PullAudioInputStreamCallback", {
        enumerable: !0,
        get: function() {
            return c.PullAudioInputStreamCallback
        }
    });
    var u = r(78);
    Object.defineProperty(t, "PushAudioOutputStreamCallback", {
        enumerable: !0,
        get: function() {
            return u.PushAudioOutputStreamCallback
        }
    });
    var p = r(79);
    Object.defineProperty(t, "KeywordRecognitionModel", {
        enumerable: !0,
        get: function() {
            return p.KeywordRecognitionModel
        }
    });
    var l = r(80);
    Object.defineProperty(t, "SessionEventArgs", {
        enumerable: !0,
        get: function() {
            return l.SessionEventArgs
        }
    });
    var f = r(81);
    Object.defineProperty(t, "RecognitionEventArgs", {
        enumerable: !0,
        get: function() {
            return f.RecognitionEventArgs
        }
    });
    var h = r(82);
    Object.defineProperty(t, "OutputFormat", {
        enumerable: !0,
        get: function() {
            return h.OutputFormat
        }
    });
    var v = r(83);
    Object.defineProperty(t, "IntentRecognitionEventArgs", {
        enumerable: !0,
        get: function() {
            return v.IntentRecognitionEventArgs
        }
    });
    var d = r(84);
    Object.defineProperty(t, "RecognitionResult", {
        enumerable: !0,
        get: function() {
            return d.RecognitionResult
        }
    });
    var y = r(85);
    Object.defineProperty(t, "SpeechRecognitionResult", {
        enumerable: !0,
        get: function() {
            return y.SpeechRecognitionResult
        }
    });
    var g = r(86);
    Object.defineProperty(t, "IntentRecognitionResult", {
        enumerable: !0,
        get: function() {
            return g.IntentRecognitionResult
        }
    });
    var m = r(87);
    Object.defineProperty(t, "LanguageUnderstandingModel", {
        enumerable: !0,
        get: function() {
            return m.LanguageUnderstandingModel
        }
    });
    var b = r(88);
    Object.defineProperty(t, "SpeechRecognitionEventArgs", {
        enumerable: !0,
        get: function() {
            return b.SpeechRecognitionEventArgs
        }
    }),
    Object.defineProperty(t, "ConversationTranscriptionEventArgs", {
        enumerable: !0,
        get: function() {
            return b.ConversationTranscriptionEventArgs
        }
    });
    var S = r(89);
    Object.defineProperty(t, "SpeechRecognitionCanceledEventArgs", {
        enumerable: !0,
        get: function() {
            return S.SpeechRecognitionCanceledEventArgs
        }
    });
    var C = r(91);
    Object.defineProperty(t, "TranslationRecognitionEventArgs", {
        enumerable: !0,
        get: function() {
            return C.TranslationRecognitionEventArgs
        }
    });
    var P = r(92);
    Object.defineProperty(t, "TranslationSynthesisEventArgs", {
        enumerable: !0,
        get: function() {
            return P.TranslationSynthesisEventArgs
        }
    });
    var w = r(93);
    Object.defineProperty(t, "TranslationRecognitionResult", {
        enumerable: !0,
        get: function() {
            return w.TranslationRecognitionResult
        }
    });
    var R = r(94);
    Object.defineProperty(t, "TranslationSynthesisResult", {
        enumerable: !0,
        get: function() {
            return R.TranslationSynthesisResult
        }
    });
    var O = r(95);
    Object.defineProperty(t, "ResultReason", {
        enumerable: !0,
        get: function() {
            return O.ResultReason
        }
    });
    var I = r(96);
    Object.defineProperty(t, "SpeechConfig", {
        enumerable: !0,
        get: function() {
            return I.SpeechConfig
        }
    }),
    Object.defineProperty(t, "SpeechConfigImpl", {
        enumerable: !0,
        get: function() {
            return I.SpeechConfigImpl
        }
    });
    var E = r(97);
    Object.defineProperty(t, "SpeechTranslationConfig", {
        enumerable: !0,
        get: function() {
            return E.SpeechTranslationConfig
        }
    }),
    Object.defineProperty(t, "SpeechTranslationConfigImpl", {
        enumerable: !0,
        get: function() {
            return E.SpeechTranslationConfigImpl
        }
    });
    var _ = r(98);
    Object.defineProperty(t, "PropertyCollection", {
        enumerable: !0,
        get: function() {
            return _.PropertyCollection
        }
    });
    var A = r(99);
    Object.defineProperty(t, "PropertyId", {
        enumerable: !0,
        get: function() {
            return A.PropertyId
        }
    });
    var T = r(100);
    Object.defineProperty(t, "Recognizer", {
        enumerable: !0,
        get: function() {
            return T.Recognizer
        }
    });
    var M = r(101);
    Object.defineProperty(t, "SpeechRecognizer", {
        enumerable: !0,
        get: function() {
            return M.SpeechRecognizer
        }
    });
    var j = r(102);
    Object.defineProperty(t, "IntentRecognizer", {
        enumerable: !0,
        get: function() {
            return j.IntentRecognizer
        }
    });
    var k = r(103);
    Object.defineProperty(t, "VoiceProfileType", {
        enumerable: !0,
        get: function() {
            return k.VoiceProfileType
        }
    });
    var D = r(104);
    Object.defineProperty(t, "TranslationRecognizer", {
        enumerable: !0,
        get: function() {
            return D.TranslationRecognizer
        }
    });
    var N = r(107);
    Object.defineProperty(t, "Translations", {
        enumerable: !0,
        get: function() {
            return N.Translations
        }
    });
    var x = r(108);
    Object.defineProperty(t, "NoMatchReason", {
        enumerable: !0,
        get: function() {
            return x.NoMatchReason
        }
    });
    var z = r(109);
    Object.defineProperty(t, "NoMatchDetails", {
        enumerable: !0,
        get: function() {
            return z.NoMatchDetails
        }
    });
    var L = r(110);
    Object.defineProperty(t, "TranslationRecognitionCanceledEventArgs", {
        enumerable: !0,
        get: function() {
            return L.TranslationRecognitionCanceledEventArgs
        }
    });
    var B = r(111);
    Object.defineProperty(t, "IntentRecognitionCanceledEventArgs", {
        enumerable: !0,
        get: function() {
            return B.IntentRecognitionCanceledEventArgs
        }
    });
    var F = r(112);
    Object.defineProperty(t, "CancellationDetailsBase", {
        enumerable: !0,
        get: function() {
            return F.CancellationDetailsBase
        }
    });
    var U = r(113);
    Object.defineProperty(t, "CancellationDetails", {
        enumerable: !0,
        get: function() {
            return U.CancellationDetails
        }
    });
    var q = r(114);
    Object.defineProperty(t, "CancellationErrorCode", {
        enumerable: !0,
        get: function() {
            return q.CancellationErrorCode
        }
    });
    var H = r(115);
    Object.defineProperty(t, "ConnectionEventArgs", {
        enumerable: !0,
        get: function() {
            return H.ConnectionEventArgs
        }
    });
    var W = r(116);
    Object.defineProperty(t, "ServiceEventArgs", {
        enumerable: !0,
        get: function() {
            return W.ServiceEventArgs
        }
    });
    var K = r(105);
    Object.defineProperty(t, "Connection", {
        enumerable: !0,
        get: function() {
            return K.Connection
        }
    });
    var V = r(117);
    Object.defineProperty(t, "PhraseListGrammar", {
        enumerable: !0,
        get: function() {
            return V.PhraseListGrammar
        }
    });
    var J = r(118);
    Object.defineProperty(t, "DialogServiceConfig", {
        enumerable: !0,
        get: function() {
            return J.DialogServiceConfig
        }
    });
    var G = r(119);
    Object.defineProperty(t, "BotFrameworkConfig", {
        enumerable: !0,
        get: function() {
            return G.BotFrameworkConfig
        }
    });
    var Q = r(120);
    Object.defineProperty(t, "CustomCommandsConfig", {
        enumerable: !0,
        get: function() {
            return Q.CustomCommandsConfig
        }
    });
    var Y = r(121);
    Object.defineProperty(t, "DialogServiceConnector", {
        enumerable: !0,
        get: function() {
            return Y.DialogServiceConnector
        }
    });
    var Z = r(125);
    Object.defineProperty(t, "ActivityReceivedEventArgs", {
        enumerable: !0,
        get: function() {
            return Z.ActivityReceivedEventArgs
        }
    });
    var X = r(126);
    Object.defineProperty(t, "TurnStatusReceivedEventArgs", {
        enumerable: !0,
        get: function() {
            return X.TurnStatusReceivedEventArgs
        }
    });
    var $ = r(128);
    Object.defineProperty(t, "ServicePropertyChannel", {
        enumerable: !0,
        get: function() {
            return $.ServicePropertyChannel
        }
    });
    var ee = r(129);
    Object.defineProperty(t, "ProfanityOption", {
        enumerable: !0,
        get: function() {
            return ee.ProfanityOption
        }
    });
    var te = r(130);
    Object.defineProperty(t, "BaseAudioPlayer", {
        enumerable: !0,
        get: function() {
            return te.BaseAudioPlayer
        }
    });
    var re = r(131);
    Object.defineProperty(t, "ConnectionMessageEventArgs", {
        enumerable: !0,
        get: function() {
            return re.ConnectionMessageEventArgs
        }
    });
    var ne = r(106);
    Object.defineProperty(t, "ConnectionMessage", {
        enumerable: !0,
        get: function() {
            return ne.ConnectionMessage
        }
    });
    var ie = r(132);
    Object.defineProperty(t, "VoiceProfile", {
        enumerable: !0,
        get: function() {
            return ie.VoiceProfile
        }
    });
    var oe = r(133);
    Object.defineProperty(t, "VoiceProfileEnrollmentResult", {
        enumerable: !0,
        get: function() {
            return oe.VoiceProfileEnrollmentResult
        }
    }),
    Object.defineProperty(t, "VoiceProfileEnrollmentCancellationDetails", {
        enumerable: !0,
        get: function() {
            return oe.VoiceProfileEnrollmentCancellationDetails
        }
    });
    var se = r(134);
    Object.defineProperty(t, "VoiceProfileResult", {
        enumerable: !0,
        get: function() {
            return se.VoiceProfileResult
        }
    }),
    Object.defineProperty(t, "VoiceProfileCancellationDetails", {
        enumerable: !0,
        get: function() {
            return se.VoiceProfileCancellationDetails
        }
    });
    var ae = r(135);
    Object.defineProperty(t, "VoiceProfilePhraseResult", {
        enumerable: !0,
        get: function() {
            return ae.VoiceProfilePhraseResult
        }
    });
    var ce = r(136);
    Object.defineProperty(t, "VoiceProfileClient", {
        enumerable: !0,
        get: function() {
            return ce.VoiceProfileClient
        }
    });
    var ue = r(137);
    Object.defineProperty(t, "SpeakerRecognizer", {
        enumerable: !0,
        get: function() {
            return ue.SpeakerRecognizer
        }
    });
    var pe = r(138);
    Object.defineProperty(t, "SpeakerIdentificationModel", {
        enumerable: !0,
        get: function() {
            return pe.SpeakerIdentificationModel
        }
    });
    var le = r(139);
    Object.defineProperty(t, "SpeakerVerificationModel", {
        enumerable: !0,
        get: function() {
            return le.SpeakerVerificationModel
        }
    });
    var fe = r(140);
    Object.defineProperty(t, "AutoDetectSourceLanguageConfig", {
        enumerable: !0,
        get: function() {
            return fe.AutoDetectSourceLanguageConfig
        }
    });
    var he = r(141);
    Object.defineProperty(t, "AutoDetectSourceLanguageResult", {
        enumerable: !0,
        get: function() {
            return he.AutoDetectSourceLanguageResult
        }
    });
    var ve = r(142);
    Object.defineProperty(t, "SourceLanguageConfig", {
        enumerable: !0,
        get: function() {
            return ve.SourceLanguageConfig
        }
    });
    var de = r(143);
    Object.defineProperty(t, "SpeakerRecognitionResult", {
        enumerable: !0,
        get: function() {
            return de.SpeakerRecognitionResult
        }
    }),
    Object.defineProperty(t, "SpeakerRecognitionResultType", {
        enumerable: !0,
        get: function() {
            return de.SpeakerRecognitionResultType
        }
    }),
    Object.defineProperty(t, "SpeakerRecognitionCancellationDetails", {
        enumerable: !0,
        get: function() {
            return de.SpeakerRecognitionCancellationDetails
        }
    });
    var ye = r(144);
    Object.defineProperty(t, "Conversation", {
        enumerable: !0,
        get: function() {
            return ye.Conversation
        }
    }),
    Object.defineProperty(t, "ConversationExpirationEventArgs", {
        enumerable: !0,
        get: function() {
            return ye.ConversationExpirationEventArgs
        }
    }),
    Object.defineProperty(t, "ConversationParticipantsChangedEventArgs", {
        enumerable: !0,
        get: function() {
            return ye.ConversationParticipantsChangedEventArgs
        }
    }),
    Object.defineProperty(t, "ConversationTranslationCanceledEventArgs", {
        enumerable: !0,
        get: function() {
            return ye.ConversationTranslationCanceledEventArgs
        }
    }),
    Object.defineProperty(t, "ConversationTranslationEventArgs", {
        enumerable: !0,
        get: function() {
            return ye.ConversationTranslationEventArgs
        }
    }),
    Object.defineProperty(t, "ConversationTranslationResult", {
        enumerable: !0,
        get: function() {
            return ye.ConversationTranslationResult
        }
    }),
    Object.defineProperty(t, "ConversationTranslator", {
        enumerable: !0,
        get: function() {
            return ye.ConversationTranslator
        }
    }),
    Object.defineProperty(t, "ConversationTranscriber", {
        enumerable: !0,
        get: function() {
            return ye.ConversationTranscriber
        }
    }),
    Object.defineProperty(t, "Participant", {
        enumerable: !0,
        get: function() {
            return ye.Participant
        }
    }),
    Object.defineProperty(t, "ParticipantChangedReason", {
        enumerable: !0,
        get: function() {
            return ye.ParticipantChangedReason
        }
    }),
    Object.defineProperty(t, "User", {
        enumerable: !0,
        get: function() {
            return ye.User
        }
    });
    var ge = r(75);
    Object.defineProperty(t, "SpeechSynthesisOutputFormat", {
        enumerable: !0,
        get: function() {
            return ge.SpeechSynthesisOutputFormat
        }
    });
    var me = r(156);
    Object.defineProperty(t, "SpeechSynthesizer", {
        enumerable: !0,
        get: function() {
            return me.SpeechSynthesizer
        }
    });
    var be = r(157);
    Object.defineProperty(t, "SpeechSynthesisResult", {
        enumerable: !0,
        get: function() {
            return be.SpeechSynthesisResult
        }
    });
    var Se = r(158);
    Object.defineProperty(t, "SpeechSynthesisEventArgs", {
        enumerable: !0,
        get: function() {
            return Se.SpeechSynthesisEventArgs
        }
    });
    var Ce = r(159);
    Object.defineProperty(t, "SpeechSynthesisWordBoundaryEventArgs", {
        enumerable: !0,
        get: function() {
            return Ce.SpeechSynthesisWordBoundaryEventArgs
        }
    });
    var Pe = r(160);
    Object.defineProperty(t, "SpeechSynthesisBookmarkEventArgs", {
        enumerable: !0,
        get: function() {
            return Pe.SpeechSynthesisBookmarkEventArgs
        }
    });
    var we = r(161);
    Object.defineProperty(t, "SpeechSynthesisVisemeEventArgs", {
        enumerable: !0,
        get: function() {
            return we.SpeechSynthesisVisemeEventArgs
        }
    });
    var Re = r(162);
    Object.defineProperty(t, "SpeakerAudioDestination", {
        enumerable: !0,
        get: function() {
            return Re.SpeakerAudioDestination
        }
    });
    var Oe = r(163);
    Object.defineProperty(t, "ConversationTranscriptionCanceledEventArgs", {
        enumerable: !0,
        get: function() {
            return Oe.ConversationTranscriptionCanceledEventArgs
        }
    });
    var Ie = r(164);
    Object.defineProperty(t, "PronunciationAssessmentGradingSystem", {
        enumerable: !0,
        get: function() {
            return Ie.PronunciationAssessmentGradingSystem
        }
    });
    var Ee = r(165);
    Object.defineProperty(t, "PronunciationAssessmentGranularity", {
        enumerable: !0,
        get: function() {
            return Ee.PronunciationAssessmentGranularity
        }
    });
    var _e = r(166);
    Object.defineProperty(t, "PronunciationAssessmentConfig", {
        enumerable: !0,
        get: function() {
            return _e.PronunciationAssessmentConfig
        }
    });
    var Ae = r(167);
    Object.defineProperty(t, "PronunciationAssessmentResult", {
        enumerable: !0,
        get: function() {
            return Ae.PronunciationAssessmentResult
        }
    })
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.AudioOutputConfigImpl = t.AudioConfigImpl = t.AudioConfig = void 0;
    var o = r(2)
      , s = r(63)
      , a = r(61)
      , c = r(64)
      , u = r(66)
      , p = r(73)
      , l = function() {
        function e() {}
        return e.fromDefaultMicrophoneInput = function() {
            var e = new o.PcmRecorder(!0);
            return new f(new o.MicAudioSource(e))
        }
        ,
        e.fromMicrophoneInput = function(e) {
            var t = new o.PcmRecorder(!0);
            return new f(new o.MicAudioSource(t,e))
        }
        ,
        e.fromWavFileInput = function(e, t) {
            return void 0 === t && (t = "unnamedBuffer.wav"),
            new f(new o.FileAudioSource(e,t))
        }
        ,
        e.fromStreamInput = function(e) {
            if (e instanceof a.PullAudioInputStreamCallback)
                return new f(new u.PullAudioInputStreamImpl(e));
            if (e instanceof a.AudioInputStream)
                return new f(e);
            if ("undefined" != typeof MediaStream && e instanceof MediaStream) {
                var t = new o.PcmRecorder(!1);
                return new f(new o.MicAudioSource(t,null,null,e))
            }
            throw new Error("Not Supported Type")
        }
        ,
        e.fromDefaultSpeakerOutput = function() {
            return new h(new a.SpeakerAudioDestination)
        }
        ,
        e.fromSpeakerOutput = function(t) {
            if (void 0 === t)
                return e.fromDefaultSpeakerOutput();
            if (t instanceof a.SpeakerAudioDestination)
                return new h(t);
            throw new Error("Not Supported Type")
        }
        ,
        e.fromAudioFileOutput = function(e) {
            return new h(new c.AudioFileWriter(e))
        }
        ,
        e.fromStreamOutput = function(e) {
            if (e instanceof a.PushAudioOutputStreamCallback)
                return new h(new p.PushAudioOutputStreamImpl(e));
            if (e instanceof a.PushAudioOutputStream)
                return new h(e);
            if (e instanceof a.PullAudioOutputStream)
                return new h(e);
            throw new Error("Not Supported Type")
        }
        ,
        e
    }();
    t.AudioConfig = l;
    var f = function(e) {
        function t(t) {
            var r = e.call(this) || this;
            return r.privSource = t,
            r
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "format", {
            get: function() {
                return this.privSource.format
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.close = function(e, t) {
            this.privSource.turnOff().then((function() {
                e && e()
            }
            ), (function(e) {
                t && t(e)
            }
            ))
        }
        ,
        t.prototype.id = function() {
            return this.privSource.id()
        }
        ,
        Object.defineProperty(t.prototype, "blob", {
            get: function() {
                return this.privSource.blob
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.turnOn = function() {
            return this.privSource.turnOn()
        }
        ,
        t.prototype.attach = function(e) {
            return this.privSource.attach(e)
        }
        ,
        t.prototype.detach = function(e) {
            return this.privSource.detach(e)
        }
        ,
        t.prototype.turnOff = function() {
            return this.privSource.turnOff()
        }
        ,
        Object.defineProperty(t.prototype, "events", {
            get: function() {
                return this.privSource.events
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.setProperty = function(e, t) {
            if (s.Contracts.throwIfNull(t, "value"),
            void 0 === this.privSource.setProperty)
                throw new Error("This AudioConfig instance does not support setting properties.");
            this.privSource.setProperty(e, t)
        }
        ,
        t.prototype.getProperty = function(e, t) {
            if (void 0 !== this.privSource.getProperty)
                return this.privSource.getProperty(e, t);
            throw new Error("This AudioConfig instance does not support getting properties.")
        }
        ,
        Object.defineProperty(t.prototype, "deviceInfo", {
            get: function() {
                return this.privSource.deviceInfo
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(l);
    t.AudioConfigImpl = f;
    var h = function(e) {
        function t(t) {
            var r = e.call(this) || this;
            return r.privDestination = t,
            r
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "format", {
            set: function(e) {
                this.privDestination.format = e
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.write = function(e) {
            this.privDestination.write(e)
        }
        ,
        t.prototype.close = function() {
            this.privDestination.close()
        }
        ,
        t.prototype.id = function() {
            return this.privDestination.id()
        }
        ,
        t.prototype.setProperty = function(e, t) {
            throw new Error("This AudioConfig instance does not support setting properties.")
        }
        ,
        t.prototype.getProperty = function(e, t) {
            throw new Error("This AudioConfig instance does not support getting properties.")
        }
        ,
        t
    }(l);
    t.AudioOutputConfigImpl = h
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.Contracts = void 0;
    var n = function() {
        function e() {}
        return e.throwIfNullOrUndefined = function(e, t) {
            if (null == e)
                throw new Error("throwIfNullOrUndefined:" + t)
        }
        ,
        e.throwIfNull = function(e, t) {
            if (null === e)
                throw new Error("throwIfNull:" + t)
        }
        ,
        e.throwIfNullOrWhitespace = function(t, r) {
            if (e.throwIfNullOrUndefined(t, r),
            ("" + t).trim().length < 1)
                throw new Error("throwIfNullOrWhitespace:" + r)
        }
        ,
        e.throwIfDisposed = function(e) {
            if (e)
                throw new Error("the object is already disposed")
        }
        ,
        e.throwIfArrayEmptyOrWhitespace = function(t, r) {
            if (e.throwIfNullOrUndefined(t, r),
            0 === t.length)
                throw new Error("throwIfArrayEmptyOrWhitespace:" + r);
            for (var n = 0, i = t; n < i.length; n++) {
                var o = i[n];
                e.throwIfNullOrWhitespace(o, r)
            }
        }
        ,
        e.throwIfFileDoesNotExist = function(t, r) {
            e.throwIfNullOrWhitespace(t, r)
        }
        ,
        e.throwIfNotUndefined = function(e, t) {
            if (void 0 !== e)
                throw new Error("throwIfNotUndefined:" + t)
        }
        ,
        e
    }();
    t.Contracts = n
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__createBinding || (Object.create ? function(e, t, r, n) {
        void 0 === n && (n = r),
        Object.defineProperty(e, n, {
            enumerable: !0,
            get: function() {
                return t[r]
            }
        })
    }
    : function(e, t, r, n) {
        void 0 === n && (n = r),
        e[n] = t[r]
    }
    )
      , i = this && this.__setModuleDefault || (Object.create ? function(e, t) {
        Object.defineProperty(e, "default", {
            enumerable: !0,
            value: t
        })
    }
    : function(e, t) {
        e.default = t
    }
    )
      , o = this && this.__importStar || function(e) {
        if (e && e.__esModule)
            return e;
        var t = {};
        if (null != e)
            for (var r in e)
                "default" !== r && Object.hasOwnProperty.call(e, r) && n(t, e, r);
        return i(t, e),
        t
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.AudioFileWriter = void 0;
    var s = o(r(65))
      , a = r(63)
      , c = function() {
        function e(e) {
            var t = this;
            this.id = function() {
                return t.privId
            }
            ,
            a.Contracts.throwIfNullOrUndefined(s.openSync, "\nFile System access not available, please use Push or PullAudioOutputStream"),
            this.privFd = s.openSync(e, "w")
        }
        return Object.defineProperty(e.prototype, "format", {
            set: function(e) {
                a.Contracts.throwIfNotUndefined(this.privAudioFormat, "format is already set"),
                this.privAudioFormat = e;
                var t = 0;
                this.privAudioFormat.hasHeader && (t = this.privAudioFormat.header.byteLength),
                void 0 !== this.privFd && (this.privWriteStream = s.createWriteStream("", {
                    fd: this.privFd,
                    start: t,
                    autoClose: !1
                }))
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.write = function(e) {
            a.Contracts.throwIfNullOrUndefined(this.privAudioFormat, "must set format before writing."),
            void 0 !== this.privWriteStream && this.privWriteStream.write(new Uint8Array(e.slice(0)))
        }
        ,
        e.prototype.close = function() {
            var e = this;
            void 0 !== this.privFd && (this.privWriteStream.on("finish", (function() {
                e.privAudioFormat.hasHeader && (e.privAudioFormat.updateHeader(e.privWriteStream.bytesWritten),
                s.writeSync(e.privFd, new Int8Array(e.privAudioFormat.header), 0, e.privAudioFormat.header.byteLength, 0)),
                s.closeSync(e.privFd),
                e.privFd = void 0
            }
            )),
            this.privWriteStream.end())
        }
        ,
        e
    }();
    t.AudioFileWriter = c
}
, function(e, t) {}
, function(e, t, r) {
    "use strict";
    (function(e) {
        var n, i = this && this.__extends || (n = function(e, t) {
            return (n = Object.setPrototypeOf || {
                __proto__: []
            }instanceof Array && function(e, t) {
                e.__proto__ = t
            }
            || function(e, t) {
                for (var r in t)
                    t.hasOwnProperty(r) && (e[r] = t[r])
            }
            )(e, t)
        }
        ,
        function(e, t) {
            function r() {
                this.constructor = e
            }
            n(e, t),
            e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
            new r)
        }
        ), o = this && this.__awaiter || function(e, t, r, n) {
            return new (r || (r = Promise))((function(i, o) {
                function s(e) {
                    try {
                        c(n.next(e))
                    } catch (e) {
                        o(e)
                    }
                }
                function a(e) {
                    try {
                        c(n.throw(e))
                    } catch (e) {
                        o(e)
                    }
                }
                function c(e) {
                    var t;
                    e.done ? i(e.value) : (t = e.value,
                    t instanceof r ? t : new r((function(e) {
                        e(t)
                    }
                    ))).then(s, a)
                }
                c((n = n.apply(e, t || [])).next())
            }
            ))
        }
        , s = this && this.__generator || function(e, t) {
            var r, n, i, o, s = {
                label: 0,
                sent: function() {
                    if (1 & i[0])
                        throw i[1];
                    return i[1]
                },
                trys: [],
                ops: []
            };
            return o = {
                next: a(0),
                throw: a(1),
                return: a(2)
            },
            "function" == typeof Symbol && (o[Symbol.iterator] = function() {
                return this
            }
            ),
            o;
            function a(o) {
                return function(a) {
                    return function(o) {
                        if (r)
                            throw new TypeError("Generator is already executing.");
                        for (; s; )
                            try {
                                if (r = 1,
                                n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                                0) : n.next) && !(i = i.call(n, o[1])).done)
                                    return i;
                                switch (n = 0,
                                i && (o = [2 & o[0], i.value]),
                                o[0]) {
                                case 0:
                                case 1:
                                    i = o;
                                    break;
                                case 4:
                                    return s.label++,
                                    {
                                        value: o[1],
                                        done: !1
                                    };
                                case 5:
                                    s.label++,
                                    n = o[1],
                                    o = [0];
                                    continue;
                                case 7:
                                    o = s.ops.pop(),
                                    s.trys.pop();
                                    continue;
                                default:
                                    if (!(i = s.trys,
                                    (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                        s = 0;
                                        continue
                                    }
                                    if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                        s.label = o[1];
                                        break
                                    }
                                    if (6 === o[0] && s.label < i[1]) {
                                        s.label = i[1],
                                        i = o;
                                        break
                                    }
                                    if (i && s.label < i[2]) {
                                        s.label = i[2],
                                        s.ops.push(o);
                                        break
                                    }
                                    i[2] && s.ops.pop(),
                                    s.trys.pop();
                                    continue
                                }
                                o = t.call(e, s)
                            } catch (e) {
                                o = [6, e],
                                n = 0
                            } finally {
                                r = i = 0
                            }
                        if (5 & o[0])
                            throw o[1];
                        return {
                            value: o[0] ? o[1] : void 0,
                            done: !0
                        }
                    }([o, a])
                }
            }
        }
        ;
        Object.defineProperty(t, "__esModule", {
            value: !0
        }),
        t.PullAudioInputStreamImpl = t.PullAudioInputStream = t.PushAudioInputStreamImpl = t.PushAudioInputStream = t.AudioInputStream = void 0;
        var a = r(53)
          , c = r(4)
          , u = r(7)
          , p = r(61)
          , l = r(72)
          , f = function() {
            function e() {}
            return e.createPushStream = function(e) {
                return h.create(e)
            }
            ,
            e.createPullStream = function(e, t) {
                return d.create(e, t)
            }
            ,
            e
        }();
        t.AudioInputStream = f;
        var h = function(e) {
            function t() {
                return null !== e && e.apply(this, arguments) || this
            }
            return i(t, e),
            t.create = function(e) {
                return new v(e)
            }
            ,
            t
        }(f);
        t.PushAudioInputStream = h;
        var v = function(t) {
            function r(e) {
                var r = t.call(this) || this;
                return r.onEvent = function(e) {
                    r.privEvents.onEvent(e),
                    c.Events.instance.onEvent(e)
                }
                ,
                r.privFormat = void 0 === e ? l.AudioStreamFormatImpl.getDefaultInputFormat() : e,
                r.privEvents = new c.EventSource,
                r.privId = u.createNoDashGuid(),
                r.privStream = new c.ChunkedArrayBufferStream(r.privFormat.avgBytesPerSec / 10),
                r
            }
            return i(r, t),
            Object.defineProperty(r.prototype, "format", {
                get: function() {
                    return Promise.resolve(this.privFormat)
                },
                enumerable: !1,
                configurable: !0
            }),
            r.prototype.write = function(e) {
                this.privStream.writeStreamChunk({
                    buffer: e,
                    isEnd: !1,
                    timeReceived: Date.now()
                })
            }
            ,
            r.prototype.close = function() {
                this.privStream.close()
            }
            ,
            r.prototype.id = function() {
                return this.privId
            }
            ,
            Object.defineProperty(r.prototype, "blob", {
                get: function() {
                    var t = this;
                    return this.attach("id").then((function(r) {
                        var n = []
                          , i = e.from("")
                          , o = function() {
                            return r.read().then((function(r) {
                                return !r || r.isEnd ? "undefined" != typeof XMLHttpRequest && "undefined" != typeof Blob ? Promise.resolve(new Blob(n)) : Promise.resolve(e.from(i)) : ("undefined" != typeof Blob ? n.push(r.buffer) : i = e.concat([i, t.toBuffer(r.buffer)]),
                                o())
                            }
                            ))
                        };
                        return o()
                    }
                    ))
                },
                enumerable: !1,
                configurable: !0
            }),
            r.prototype.turnOn = function() {
                this.onEvent(new c.AudioSourceInitializingEvent(this.privId)),
                this.onEvent(new c.AudioSourceReadyEvent(this.privId))
            }
            ,
            r.prototype.attach = function(e) {
                return o(this, void 0, void 0, (function() {
                    var t, r = this;
                    return s(this, (function(n) {
                        switch (n.label) {
                        case 0:
                            return this.onEvent(new c.AudioStreamNodeAttachingEvent(this.privId,e)),
                            [4, this.turnOn()];
                        case 1:
                            return n.sent(),
                            t = this.privStream,
                            this.onEvent(new c.AudioStreamNodeAttachedEvent(this.privId,e)),
                            [2, {
                                detach: function() {
                                    return o(r, void 0, void 0, (function() {
                                        return s(this, (function(t) {
                                            return this.onEvent(new c.AudioStreamNodeDetachedEvent(this.privId,e)),
                                            [2, this.turnOff()]
                                        }
                                        ))
                                    }
                                    ))
                                },
                                id: function() {
                                    return e
                                },
                                read: function() {
                                    return t.read()
                                }
                            }]
                        }
                    }
                    ))
                }
                ))
            }
            ,
            r.prototype.detach = function(e) {
                this.onEvent(new c.AudioStreamNodeDetachedEvent(this.privId,e))
            }
            ,
            r.prototype.turnOff = function() {}
            ,
            Object.defineProperty(r.prototype, "events", {
                get: function() {
                    return this.privEvents
                },
                enumerable: !1,
                configurable: !0
            }),
            Object.defineProperty(r.prototype, "deviceInfo", {
                get: function() {
                    return Promise.resolve({
                        bitspersample: this.privFormat.bitsPerSample,
                        channelcount: this.privFormat.channels,
                        connectivity: a.connectivity.Unknown,
                        manufacturer: "Speech SDK",
                        model: "PushStream",
                        samplerate: this.privFormat.samplesPerSec,
                        type: a.type.Stream
                    })
                },
                enumerable: !1,
                configurable: !0
            }),
            r.prototype.toBuffer = function(t) {
                for (var r = e.alloc(t.byteLength), n = new Uint8Array(t), i = 0; i < r.length; ++i)
                    r[i] = n[i];
                return r
            }
            ,
            r
        }(h);
        t.PushAudioInputStreamImpl = v;
        var d = function(e) {
            function t() {
                return e.call(this) || this
            }
            return i(t, e),
            t.create = function(e, t) {
                return new y(e,t)
            }
            ,
            t
        }(f);
        t.PullAudioInputStream = d;
        var y = function(e) {
            function t(t, r) {
                var n = e.call(this) || this;
                return n.onEvent = function(e) {
                    n.privEvents.onEvent(e),
                    c.Events.instance.onEvent(e)
                }
                ,
                n.privFormat = void 0 === r ? p.AudioStreamFormat.getDefaultInputFormat() : r,
                n.privEvents = new c.EventSource,
                n.privId = u.createNoDashGuid(),
                n.privCallback = t,
                n.privIsClosed = !1,
                n.privBufferSize = n.privFormat.avgBytesPerSec / 10,
                n
            }
            return i(t, e),
            Object.defineProperty(t.prototype, "format", {
                get: function() {
                    return Promise.resolve(this.privFormat)
                },
                enumerable: !1,
                configurable: !0
            }),
            t.prototype.close = function() {
                this.privIsClosed = !0,
                this.privCallback.close()
            }
            ,
            t.prototype.id = function() {
                return this.privId
            }
            ,
            Object.defineProperty(t.prototype, "blob", {
                get: function() {
                    return Promise.reject("Not implemented")
                },
                enumerable: !1,
                configurable: !0
            }),
            t.prototype.turnOn = function() {
                this.onEvent(new c.AudioSourceInitializingEvent(this.privId)),
                this.onEvent(new c.AudioSourceReadyEvent(this.privId))
            }
            ,
            t.prototype.attach = function(e) {
                return o(this, void 0, void 0, (function() {
                    var t = this;
                    return s(this, (function(r) {
                        switch (r.label) {
                        case 0:
                            return this.onEvent(new c.AudioStreamNodeAttachingEvent(this.privId,e)),
                            [4, this.turnOn()];
                        case 1:
                            return r.sent(),
                            this.onEvent(new c.AudioStreamNodeAttachedEvent(this.privId,e)),
                            [2, {
                                detach: function() {
                                    return t.privCallback.close(),
                                    t.onEvent(new c.AudioStreamNodeDetachedEvent(t.privId,e)),
                                    t.turnOff()
                                },
                                id: function() {
                                    return e
                                },
                                read: function() {
                                    for (var e, r = 0; r < t.privBufferSize; ) {
                                        var n = new ArrayBuffer(t.privBufferSize - r)
                                          , i = t.privCallback.read(n);
                                        if (void 0 === e)
                                            e = n;
                                        else
                                            new Int8Array(e).set(new Int8Array(n), r);
                                        if (0 === i)
                                            break;
                                        r += i
                                    }
                                    return Promise.resolve({
                                        buffer: e.slice(0, r),
                                        isEnd: t.privIsClosed || 0 === r,
                                        timeReceived: Date.now()
                                    })
                                }
                            }]
                        }
                    }
                    ))
                }
                ))
            }
            ,
            t.prototype.detach = function(e) {
                this.onEvent(new c.AudioStreamNodeDetachedEvent(this.privId,e))
            }
            ,
            t.prototype.turnOff = function() {}
            ,
            Object.defineProperty(t.prototype, "events", {
                get: function() {
                    return this.privEvents
                },
                enumerable: !1,
                configurable: !0
            }),
            Object.defineProperty(t.prototype, "deviceInfo", {
                get: function() {
                    return Promise.resolve({
                        bitspersample: this.privFormat.bitsPerSample,
                        channelcount: this.privFormat.channels,
                        connectivity: a.connectivity.Unknown,
                        manufacturer: "Speech SDK",
                        model: "PullStream",
                        samplerate: this.privFormat.samplesPerSec,
                        type: a.type.Stream
                    })
                },
                enumerable: !1,
                configurable: !0
            }),
            t
        }(d);
        t.PullAudioInputStreamImpl = y
    }
    ).call(this, r(67).Buffer)
}
, function(e, t, r) {
    "use strict";
    (function(e) {
        /*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <http://feross.org>
 * @license  MIT
 */
        var n = r(69)
          , i = r(70)
          , o = r(71);
        function s() {
            return c.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823
        }
        function a(e, t) {
            if (s() < t)
                throw new RangeError("Invalid typed array length");
            return c.TYPED_ARRAY_SUPPORT ? (e = new Uint8Array(t)).__proto__ = c.prototype : (null === e && (e = new c(t)),
            e.length = t),
            e
        }
        function c(e, t, r) {
            if (!(c.TYPED_ARRAY_SUPPORT || this instanceof c))
                return new c(e,t,r);
            if ("number" == typeof e) {
                if ("string" == typeof t)
                    throw new Error("If encoding is specified then the first argument must be a string");
                return l(this, e)
            }
            return u(this, e, t, r)
        }
        function u(e, t, r, n) {
            if ("number" == typeof t)
                throw new TypeError('"value" argument must not be a number');
            return "undefined" != typeof ArrayBuffer && t instanceof ArrayBuffer ? function(e, t, r, n) {
                if (t.byteLength,
                r < 0 || t.byteLength < r)
                    throw new RangeError("'offset' is out of bounds");
                if (t.byteLength < r + (n || 0))
                    throw new RangeError("'length' is out of bounds");
                t = void 0 === r && void 0 === n ? new Uint8Array(t) : void 0 === n ? new Uint8Array(t,r) : new Uint8Array(t,r,n);
                c.TYPED_ARRAY_SUPPORT ? (e = t).__proto__ = c.prototype : e = f(e, t);
                return e
            }(e, t, r, n) : "string" == typeof t ? function(e, t, r) {
                "string" == typeof r && "" !== r || (r = "utf8");
                if (!c.isEncoding(r))
                    throw new TypeError('"encoding" must be a valid string encoding');
                var n = 0 | v(t, r)
                  , i = (e = a(e, n)).write(t, r);
                i !== n && (e = e.slice(0, i));
                return e
            }(e, t, r) : function(e, t) {
                if (c.isBuffer(t)) {
                    var r = 0 | h(t.length);
                    return 0 === (e = a(e, r)).length || t.copy(e, 0, 0, r),
                    e
                }
                if (t) {
                    if ("undefined" != typeof ArrayBuffer && t.buffer instanceof ArrayBuffer || "length"in t)
                        return "number" != typeof t.length || (n = t.length) != n ? a(e, 0) : f(e, t);
                    if ("Buffer" === t.type && o(t.data))
                        return f(e, t.data)
                }
                var n;
                throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")
            }(e, t)
        }
        function p(e) {
            if ("number" != typeof e)
                throw new TypeError('"size" argument must be a number');
            if (e < 0)
                throw new RangeError('"size" argument must not be negative')
        }
        function l(e, t) {
            if (p(t),
            e = a(e, t < 0 ? 0 : 0 | h(t)),
            !c.TYPED_ARRAY_SUPPORT)
                for (var r = 0; r < t; ++r)
                    e[r] = 0;
            return e
        }
        function f(e, t) {
            var r = t.length < 0 ? 0 : 0 | h(t.length);
            e = a(e, r);
            for (var n = 0; n < r; n += 1)
                e[n] = 255 & t[n];
            return e
        }
        function h(e) {
            if (e >= s())
                throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + s().toString(16) + " bytes");
            return 0 | e
        }
        function v(e, t) {
            if (c.isBuffer(e))
                return e.length;
            if ("undefined" != typeof ArrayBuffer && "function" == typeof ArrayBuffer.isView && (ArrayBuffer.isView(e) || e instanceof ArrayBuffer))
                return e.byteLength;
            "string" != typeof e && (e = "" + e);
            var r = e.length;
            if (0 === r)
                return 0;
            for (var n = !1; ; )
                switch (t) {
                case "ascii":
                case "latin1":
                case "binary":
                    return r;
                case "utf8":
                case "utf-8":
                case void 0:
                    return U(e).length;
                case "ucs2":
                case "ucs-2":
                case "utf16le":
                case "utf-16le":
                    return 2 * r;
                case "hex":
                    return r >>> 1;
                case "base64":
                    return q(e).length;
                default:
                    if (n)
                        return U(e).length;
                    t = ("" + t).toLowerCase(),
                    n = !0
                }
        }
        function d(e, t, r) {
            var n = !1;
            if ((void 0 === t || t < 0) && (t = 0),
            t > this.length)
                return "";
            if ((void 0 === r || r > this.length) && (r = this.length),
            r <= 0)
                return "";
            if ((r >>>= 0) <= (t >>>= 0))
                return "";
            for (e || (e = "utf8"); ; )
                switch (e) {
                case "hex":
                    return T(this, t, r);
                case "utf8":
                case "utf-8":
                    return I(this, t, r);
                case "ascii":
                    return _(this, t, r);
                case "latin1":
                case "binary":
                    return A(this, t, r);
                case "base64":
                    return O(this, t, r);
                case "ucs2":
                case "ucs-2":
                case "utf16le":
                case "utf-16le":
                    return M(this, t, r);
                default:
                    if (n)
                        throw new TypeError("Unknown encoding: " + e);
                    e = (e + "").toLowerCase(),
                    n = !0
                }
        }
        function y(e, t, r) {
            var n = e[t];
            e[t] = e[r],
            e[r] = n
        }
        function g(e, t, r, n, i) {
            if (0 === e.length)
                return -1;
            if ("string" == typeof r ? (n = r,
            r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648),
            r = +r,
            isNaN(r) && (r = i ? 0 : e.length - 1),
            r < 0 && (r = e.length + r),
            r >= e.length) {
                if (i)
                    return -1;
                r = e.length - 1
            } else if (r < 0) {
                if (!i)
                    return -1;
                r = 0
            }
            if ("string" == typeof t && (t = c.from(t, n)),
            c.isBuffer(t))
                return 0 === t.length ? -1 : m(e, t, r, n, i);
            if ("number" == typeof t)
                return t &= 255,
                c.TYPED_ARRAY_SUPPORT && "function" == typeof Uint8Array.prototype.indexOf ? i ? Uint8Array.prototype.indexOf.call(e, t, r) : Uint8Array.prototype.lastIndexOf.call(e, t, r) : m(e, [t], r, n, i);
            throw new TypeError("val must be string, number or Buffer")
        }
        function m(e, t, r, n, i) {
            var o, s = 1, a = e.length, c = t.length;
            if (void 0 !== n && ("ucs2" === (n = String(n).toLowerCase()) || "ucs-2" === n || "utf16le" === n || "utf-16le" === n)) {
                if (e.length < 2 || t.length < 2)
                    return -1;
                s = 2,
                a /= 2,
                c /= 2,
                r /= 2
            }
            function u(e, t) {
                return 1 === s ? e[t] : e.readUInt16BE(t * s)
            }
            if (i) {
                var p = -1;
                for (o = r; o < a; o++)
                    if (u(e, o) === u(t, -1 === p ? 0 : o - p)) {
                        if (-1 === p && (p = o),
                        o - p + 1 === c)
                            return p * s
                    } else
                        -1 !== p && (o -= o - p),
                        p = -1
            } else
                for (r + c > a && (r = a - c),
                o = r; o >= 0; o--) {
                    for (var l = !0, f = 0; f < c; f++)
                        if (u(e, o + f) !== u(t, f)) {
                            l = !1;
                            break
                        }
                    if (l)
                        return o
                }
            return -1
        }
        function b(e, t, r, n) {
            r = Number(r) || 0;
            var i = e.length - r;
            n ? (n = Number(n)) > i && (n = i) : n = i;
            var o = t.length;
            if (o % 2 != 0)
                throw new TypeError("Invalid hex string");
            n > o / 2 && (n = o / 2);
            for (var s = 0; s < n; ++s) {
                var a = parseInt(t.substr(2 * s, 2), 16);
                if (isNaN(a))
                    return s;
                e[r + s] = a
            }
            return s
        }
        function S(e, t, r, n) {
            return H(U(t, e.length - r), e, r, n)
        }
        function C(e, t, r, n) {
            return H(function(e) {
                for (var t = [], r = 0; r < e.length; ++r)
                    t.push(255 & e.charCodeAt(r));
                return t
            }(t), e, r, n)
        }
        function P(e, t, r, n) {
            return C(e, t, r, n)
        }
        function w(e, t, r, n) {
            return H(q(t), e, r, n)
        }
        function R(e, t, r, n) {
            return H(function(e, t) {
                for (var r, n, i, o = [], s = 0; s < e.length && !((t -= 2) < 0); ++s)
                    n = (r = e.charCodeAt(s)) >> 8,
                    i = r % 256,
                    o.push(i),
                    o.push(n);
                return o
            }(t, e.length - r), e, r, n)
        }
        function O(e, t, r) {
            return 0 === t && r === e.length ? n.fromByteArray(e) : n.fromByteArray(e.slice(t, r))
        }
        function I(e, t, r) {
            r = Math.min(e.length, r);
            for (var n = [], i = t; i < r; ) {
                var o, s, a, c, u = e[i], p = null, l = u > 239 ? 4 : u > 223 ? 3 : u > 191 ? 2 : 1;
                if (i + l <= r)
                    switch (l) {
                    case 1:
                        u < 128 && (p = u);
                        break;
                    case 2:
                        128 == (192 & (o = e[i + 1])) && (c = (31 & u) << 6 | 63 & o) > 127 && (p = c);
                        break;
                    case 3:
                        o = e[i + 1],
                        s = e[i + 2],
                        128 == (192 & o) && 128 == (192 & s) && (c = (15 & u) << 12 | (63 & o) << 6 | 63 & s) > 2047 && (c < 55296 || c > 57343) && (p = c);
                        break;
                    case 4:
                        o = e[i + 1],
                        s = e[i + 2],
                        a = e[i + 3],
                        128 == (192 & o) && 128 == (192 & s) && 128 == (192 & a) && (c = (15 & u) << 18 | (63 & o) << 12 | (63 & s) << 6 | 63 & a) > 65535 && c < 1114112 && (p = c)
                    }
                null === p ? (p = 65533,
                l = 1) : p > 65535 && (p -= 65536,
                n.push(p >>> 10 & 1023 | 55296),
                p = 56320 | 1023 & p),
                n.push(p),
                i += l
            }
            return function(e) {
                var t = e.length;
                if (t <= E)
                    return String.fromCharCode.apply(String, e);
                var r = ""
                  , n = 0;
                for (; n < t; )
                    r += String.fromCharCode.apply(String, e.slice(n, n += E));
                return r
            }(n)
        }
        t.Buffer = c,
        t.SlowBuffer = function(e) {
            +e != e && (e = 0);
            return c.alloc(+e)
        }
        ,
        t.INSPECT_MAX_BYTES = 50,
        c.TYPED_ARRAY_SUPPORT = void 0 !== e.TYPED_ARRAY_SUPPORT ? e.TYPED_ARRAY_SUPPORT : function() {
            try {
                var e = new Uint8Array(1);
                return e.__proto__ = {
                    __proto__: Uint8Array.prototype,
                    foo: function() {
                        return 42
                    }
                },
                42 === e.foo() && "function" == typeof e.subarray && 0 === e.subarray(1, 1).byteLength
            } catch (e) {
                return !1
            }
        }(),
        t.kMaxLength = s(),
        c.poolSize = 8192,
        c._augment = function(e) {
            return e.__proto__ = c.prototype,
            e
        }
        ,
        c.from = function(e, t, r) {
            return u(null, e, t, r)
        }
        ,
        c.TYPED_ARRAY_SUPPORT && (c.prototype.__proto__ = Uint8Array.prototype,
        c.__proto__ = Uint8Array,
        "undefined" != typeof Symbol && Symbol.species && c[Symbol.species] === c && Object.defineProperty(c, Symbol.species, {
            value: null,
            configurable: !0
        })),
        c.alloc = function(e, t, r) {
            return function(e, t, r, n) {
                return p(t),
                t <= 0 ? a(e, t) : void 0 !== r ? "string" == typeof n ? a(e, t).fill(r, n) : a(e, t).fill(r) : a(e, t)
            }(null, e, t, r)
        }
        ,
        c.allocUnsafe = function(e) {
            return l(null, e)
        }
        ,
        c.allocUnsafeSlow = function(e) {
            return l(null, e)
        }
        ,
        c.isBuffer = function(e) {
            return !(null == e || !e._isBuffer)
        }
        ,
        c.compare = function(e, t) {
            if (!c.isBuffer(e) || !c.isBuffer(t))
                throw new TypeError("Arguments must be Buffers");
            if (e === t)
                return 0;
            for (var r = e.length, n = t.length, i = 0, o = Math.min(r, n); i < o; ++i)
                if (e[i] !== t[i]) {
                    r = e[i],
                    n = t[i];
                    break
                }
            return r < n ? -1 : n < r ? 1 : 0
        }
        ,
        c.isEncoding = function(e) {
            switch (String(e).toLowerCase()) {
            case "hex":
            case "utf8":
            case "utf-8":
            case "ascii":
            case "latin1":
            case "binary":
            case "base64":
            case "ucs2":
            case "ucs-2":
            case "utf16le":
            case "utf-16le":
                return !0;
            default:
                return !1
            }
        }
        ,
        c.concat = function(e, t) {
            if (!o(e))
                throw new TypeError('"list" argument must be an Array of Buffers');
            if (0 === e.length)
                return c.alloc(0);
            var r;
            if (void 0 === t)
                for (t = 0,
                r = 0; r < e.length; ++r)
                    t += e[r].length;
            var n = c.allocUnsafe(t)
              , i = 0;
            for (r = 0; r < e.length; ++r) {
                var s = e[r];
                if (!c.isBuffer(s))
                    throw new TypeError('"list" argument must be an Array of Buffers');
                s.copy(n, i),
                i += s.length
            }
            return n
        }
        ,
        c.byteLength = v,
        c.prototype._isBuffer = !0,
        c.prototype.swap16 = function() {
            var e = this.length;
            if (e % 2 != 0)
                throw new RangeError("Buffer size must be a multiple of 16-bits");
            for (var t = 0; t < e; t += 2)
                y(this, t, t + 1);
            return this
        }
        ,
        c.prototype.swap32 = function() {
            var e = this.length;
            if (e % 4 != 0)
                throw new RangeError("Buffer size must be a multiple of 32-bits");
            for (var t = 0; t < e; t += 4)
                y(this, t, t + 3),
                y(this, t + 1, t + 2);
            return this
        }
        ,
        c.prototype.swap64 = function() {
            var e = this.length;
            if (e % 8 != 0)
                throw new RangeError("Buffer size must be a multiple of 64-bits");
            for (var t = 0; t < e; t += 8)
                y(this, t, t + 7),
                y(this, t + 1, t + 6),
                y(this, t + 2, t + 5),
                y(this, t + 3, t + 4);
            return this
        }
        ,
        c.prototype.toString = function() {
            var e = 0 | this.length;
            return 0 === e ? "" : 0 === arguments.length ? I(this, 0, e) : d.apply(this, arguments)
        }
        ,
        c.prototype.equals = function(e) {
            if (!c.isBuffer(e))
                throw new TypeError("Argument must be a Buffer");
            return this === e || 0 === c.compare(this, e)
        }
        ,
        c.prototype.inspect = function() {
            var e = ""
              , r = t.INSPECT_MAX_BYTES;
            return this.length > 0 && (e = this.toString("hex", 0, r).match(/.{2}/g).join(" "),
            this.length > r && (e += " ... ")),
            "<Buffer " + e + ">"
        }
        ,
        c.prototype.compare = function(e, t, r, n, i) {
            if (!c.isBuffer(e))
                throw new TypeError("Argument must be a Buffer");
            if (void 0 === t && (t = 0),
            void 0 === r && (r = e ? e.length : 0),
            void 0 === n && (n = 0),
            void 0 === i && (i = this.length),
            t < 0 || r > e.length || n < 0 || i > this.length)
                throw new RangeError("out of range index");
            if (n >= i && t >= r)
                return 0;
            if (n >= i)
                return -1;
            if (t >= r)
                return 1;
            if (this === e)
                return 0;
            for (var o = (i >>>= 0) - (n >>>= 0), s = (r >>>= 0) - (t >>>= 0), a = Math.min(o, s), u = this.slice(n, i), p = e.slice(t, r), l = 0; l < a; ++l)
                if (u[l] !== p[l]) {
                    o = u[l],
                    s = p[l];
                    break
                }
            return o < s ? -1 : s < o ? 1 : 0
        }
        ,
        c.prototype.includes = function(e, t, r) {
            return -1 !== this.indexOf(e, t, r)
        }
        ,
        c.prototype.indexOf = function(e, t, r) {
            return g(this, e, t, r, !0)
        }
        ,
        c.prototype.lastIndexOf = function(e, t, r) {
            return g(this, e, t, r, !1)
        }
        ,
        c.prototype.write = function(e, t, r, n) {
            if (void 0 === t)
                n = "utf8",
                r = this.length,
                t = 0;
            else if (void 0 === r && "string" == typeof t)
                n = t,
                r = this.length,
                t = 0;
            else {
                if (!isFinite(t))
                    throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
                t |= 0,
                isFinite(r) ? (r |= 0,
                void 0 === n && (n = "utf8")) : (n = r,
                r = void 0)
            }
            var i = this.length - t;
            if ((void 0 === r || r > i) && (r = i),
            e.length > 0 && (r < 0 || t < 0) || t > this.length)
                throw new RangeError("Attempt to write outside buffer bounds");
            n || (n = "utf8");
            for (var o = !1; ; )
                switch (n) {
                case "hex":
                    return b(this, e, t, r);
                case "utf8":
                case "utf-8":
                    return S(this, e, t, r);
                case "ascii":
                    return C(this, e, t, r);
                case "latin1":
                case "binary":
                    return P(this, e, t, r);
                case "base64":
                    return w(this, e, t, r);
                case "ucs2":
                case "ucs-2":
                case "utf16le":
                case "utf-16le":
                    return R(this, e, t, r);
                default:
                    if (o)
                        throw new TypeError("Unknown encoding: " + n);
                    n = ("" + n).toLowerCase(),
                    o = !0
                }
        }
        ,
        c.prototype.toJSON = function() {
            return {
                type: "Buffer",
                data: Array.prototype.slice.call(this._arr || this, 0)
            }
        }
        ;
        var E = 4096;
        function _(e, t, r) {
            var n = "";
            r = Math.min(e.length, r);
            for (var i = t; i < r; ++i)
                n += String.fromCharCode(127 & e[i]);
            return n
        }
        function A(e, t, r) {
            var n = "";
            r = Math.min(e.length, r);
            for (var i = t; i < r; ++i)
                n += String.fromCharCode(e[i]);
            return n
        }
        function T(e, t, r) {
            var n = e.length;
            (!t || t < 0) && (t = 0),
            (!r || r < 0 || r > n) && (r = n);
            for (var i = "", o = t; o < r; ++o)
                i += F(e[o]);
            return i
        }
        function M(e, t, r) {
            for (var n = e.slice(t, r), i = "", o = 0; o < n.length; o += 2)
                i += String.fromCharCode(n[o] + 256 * n[o + 1]);
            return i
        }
        function j(e, t, r) {
            if (e % 1 != 0 || e < 0)
                throw new RangeError("offset is not uint");
            if (e + t > r)
                throw new RangeError("Trying to access beyond buffer length")
        }
        function k(e, t, r, n, i, o) {
            if (!c.isBuffer(e))
                throw new TypeError('"buffer" argument must be a Buffer instance');
            if (t > i || t < o)
                throw new RangeError('"value" argument is out of bounds');
            if (r + n > e.length)
                throw new RangeError("Index out of range")
        }
        function D(e, t, r, n) {
            t < 0 && (t = 65535 + t + 1);
            for (var i = 0, o = Math.min(e.length - r, 2); i < o; ++i)
                e[r + i] = (t & 255 << 8 * (n ? i : 1 - i)) >>> 8 * (n ? i : 1 - i)
        }
        function N(e, t, r, n) {
            t < 0 && (t = 4294967295 + t + 1);
            for (var i = 0, o = Math.min(e.length - r, 4); i < o; ++i)
                e[r + i] = t >>> 8 * (n ? i : 3 - i) & 255
        }
        function x(e, t, r, n, i, o) {
            if (r + n > e.length)
                throw new RangeError("Index out of range");
            if (r < 0)
                throw new RangeError("Index out of range")
        }
        function z(e, t, r, n, o) {
            return o || x(e, 0, r, 4),
            i.write(e, t, r, n, 23, 4),
            r + 4
        }
        function L(e, t, r, n, o) {
            return o || x(e, 0, r, 8),
            i.write(e, t, r, n, 52, 8),
            r + 8
        }
        c.prototype.slice = function(e, t) {
            var r, n = this.length;
            if ((e = ~~e) < 0 ? (e += n) < 0 && (e = 0) : e > n && (e = n),
            (t = void 0 === t ? n : ~~t) < 0 ? (t += n) < 0 && (t = 0) : t > n && (t = n),
            t < e && (t = e),
            c.TYPED_ARRAY_SUPPORT)
                (r = this.subarray(e, t)).__proto__ = c.prototype;
            else {
                var i = t - e;
                r = new c(i,void 0);
                for (var o = 0; o < i; ++o)
                    r[o] = this[o + e]
            }
            return r
        }
        ,
        c.prototype.readUIntLE = function(e, t, r) {
            e |= 0,
            t |= 0,
            r || j(e, t, this.length);
            for (var n = this[e], i = 1, o = 0; ++o < t && (i *= 256); )
                n += this[e + o] * i;
            return n
        }
        ,
        c.prototype.readUIntBE = function(e, t, r) {
            e |= 0,
            t |= 0,
            r || j(e, t, this.length);
            for (var n = this[e + --t], i = 1; t > 0 && (i *= 256); )
                n += this[e + --t] * i;
            return n
        }
        ,
        c.prototype.readUInt8 = function(e, t) {
            return t || j(e, 1, this.length),
            this[e]
        }
        ,
        c.prototype.readUInt16LE = function(e, t) {
            return t || j(e, 2, this.length),
            this[e] | this[e + 1] << 8
        }
        ,
        c.prototype.readUInt16BE = function(e, t) {
            return t || j(e, 2, this.length),
            this[e] << 8 | this[e + 1]
        }
        ,
        c.prototype.readUInt32LE = function(e, t) {
            return t || j(e, 4, this.length),
            (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + 16777216 * this[e + 3]
        }
        ,
        c.prototype.readUInt32BE = function(e, t) {
            return t || j(e, 4, this.length),
            16777216 * this[e] + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3])
        }
        ,
        c.prototype.readIntLE = function(e, t, r) {
            e |= 0,
            t |= 0,
            r || j(e, t, this.length);
            for (var n = this[e], i = 1, o = 0; ++o < t && (i *= 256); )
                n += this[e + o] * i;
            return n >= (i *= 128) && (n -= Math.pow(2, 8 * t)),
            n
        }
        ,
        c.prototype.readIntBE = function(e, t, r) {
            e |= 0,
            t |= 0,
            r || j(e, t, this.length);
            for (var n = t, i = 1, o = this[e + --n]; n > 0 && (i *= 256); )
                o += this[e + --n] * i;
            return o >= (i *= 128) && (o -= Math.pow(2, 8 * t)),
            o
        }
        ,
        c.prototype.readInt8 = function(e, t) {
            return t || j(e, 1, this.length),
            128 & this[e] ? -1 * (255 - this[e] + 1) : this[e]
        }
        ,
        c.prototype.readInt16LE = function(e, t) {
            t || j(e, 2, this.length);
            var r = this[e] | this[e + 1] << 8;
            return 32768 & r ? 4294901760 | r : r
        }
        ,
        c.prototype.readInt16BE = function(e, t) {
            t || j(e, 2, this.length);
            var r = this[e + 1] | this[e] << 8;
            return 32768 & r ? 4294901760 | r : r
        }
        ,
        c.prototype.readInt32LE = function(e, t) {
            return t || j(e, 4, this.length),
            this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24
        }
        ,
        c.prototype.readInt32BE = function(e, t) {
            return t || j(e, 4, this.length),
            this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]
        }
        ,
        c.prototype.readFloatLE = function(e, t) {
            return t || j(e, 4, this.length),
            i.read(this, e, !0, 23, 4)
        }
        ,
        c.prototype.readFloatBE = function(e, t) {
            return t || j(e, 4, this.length),
            i.read(this, e, !1, 23, 4)
        }
        ,
        c.prototype.readDoubleLE = function(e, t) {
            return t || j(e, 8, this.length),
            i.read(this, e, !0, 52, 8)
        }
        ,
        c.prototype.readDoubleBE = function(e, t) {
            return t || j(e, 8, this.length),
            i.read(this, e, !1, 52, 8)
        }
        ,
        c.prototype.writeUIntLE = function(e, t, r, n) {
            (e = +e,
            t |= 0,
            r |= 0,
            n) || k(this, e, t, r, Math.pow(2, 8 * r) - 1, 0);
            var i = 1
              , o = 0;
            for (this[t] = 255 & e; ++o < r && (i *= 256); )
                this[t + o] = e / i & 255;
            return t + r
        }
        ,
        c.prototype.writeUIntBE = function(e, t, r, n) {
            (e = +e,
            t |= 0,
            r |= 0,
            n) || k(this, e, t, r, Math.pow(2, 8 * r) - 1, 0);
            var i = r - 1
              , o = 1;
            for (this[t + i] = 255 & e; --i >= 0 && (o *= 256); )
                this[t + i] = e / o & 255;
            return t + r
        }
        ,
        c.prototype.writeUInt8 = function(e, t, r) {
            return e = +e,
            t |= 0,
            r || k(this, e, t, 1, 255, 0),
            c.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)),
            this[t] = 255 & e,
            t + 1
        }
        ,
        c.prototype.writeUInt16LE = function(e, t, r) {
            return e = +e,
            t |= 0,
            r || k(this, e, t, 2, 65535, 0),
            c.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e,
            this[t + 1] = e >>> 8) : D(this, e, t, !0),
            t + 2
        }
        ,
        c.prototype.writeUInt16BE = function(e, t, r) {
            return e = +e,
            t |= 0,
            r || k(this, e, t, 2, 65535, 0),
            c.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 8,
            this[t + 1] = 255 & e) : D(this, e, t, !1),
            t + 2
        }
        ,
        c.prototype.writeUInt32LE = function(e, t, r) {
            return e = +e,
            t |= 0,
            r || k(this, e, t, 4, 4294967295, 0),
            c.TYPED_ARRAY_SUPPORT ? (this[t + 3] = e >>> 24,
            this[t + 2] = e >>> 16,
            this[t + 1] = e >>> 8,
            this[t] = 255 & e) : N(this, e, t, !0),
            t + 4
        }
        ,
        c.prototype.writeUInt32BE = function(e, t, r) {
            return e = +e,
            t |= 0,
            r || k(this, e, t, 4, 4294967295, 0),
            c.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 24,
            this[t + 1] = e >>> 16,
            this[t + 2] = e >>> 8,
            this[t + 3] = 255 & e) : N(this, e, t, !1),
            t + 4
        }
        ,
        c.prototype.writeIntLE = function(e, t, r, n) {
            if (e = +e,
            t |= 0,
            !n) {
                var i = Math.pow(2, 8 * r - 1);
                k(this, e, t, r, i - 1, -i)
            }
            var o = 0
              , s = 1
              , a = 0;
            for (this[t] = 255 & e; ++o < r && (s *= 256); )
                e < 0 && 0 === a && 0 !== this[t + o - 1] && (a = 1),
                this[t + o] = (e / s >> 0) - a & 255;
            return t + r
        }
        ,
        c.prototype.writeIntBE = function(e, t, r, n) {
            if (e = +e,
            t |= 0,
            !n) {
                var i = Math.pow(2, 8 * r - 1);
                k(this, e, t, r, i - 1, -i)
            }
            var o = r - 1
              , s = 1
              , a = 0;
            for (this[t + o] = 255 & e; --o >= 0 && (s *= 256); )
                e < 0 && 0 === a && 0 !== this[t + o + 1] && (a = 1),
                this[t + o] = (e / s >> 0) - a & 255;
            return t + r
        }
        ,
        c.prototype.writeInt8 = function(e, t, r) {
            return e = +e,
            t |= 0,
            r || k(this, e, t, 1, 127, -128),
            c.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)),
            e < 0 && (e = 255 + e + 1),
            this[t] = 255 & e,
            t + 1
        }
        ,
        c.prototype.writeInt16LE = function(e, t, r) {
            return e = +e,
            t |= 0,
            r || k(this, e, t, 2, 32767, -32768),
            c.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e,
            this[t + 1] = e >>> 8) : D(this, e, t, !0),
            t + 2
        }
        ,
        c.prototype.writeInt16BE = function(e, t, r) {
            return e = +e,
            t |= 0,
            r || k(this, e, t, 2, 32767, -32768),
            c.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 8,
            this[t + 1] = 255 & e) : D(this, e, t, !1),
            t + 2
        }
        ,
        c.prototype.writeInt32LE = function(e, t, r) {
            return e = +e,
            t |= 0,
            r || k(this, e, t, 4, 2147483647, -2147483648),
            c.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e,
            this[t + 1] = e >>> 8,
            this[t + 2] = e >>> 16,
            this[t + 3] = e >>> 24) : N(this, e, t, !0),
            t + 4
        }
        ,
        c.prototype.writeInt32BE = function(e, t, r) {
            return e = +e,
            t |= 0,
            r || k(this, e, t, 4, 2147483647, -2147483648),
            e < 0 && (e = 4294967295 + e + 1),
            c.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 24,
            this[t + 1] = e >>> 16,
            this[t + 2] = e >>> 8,
            this[t + 3] = 255 & e) : N(this, e, t, !1),
            t + 4
        }
        ,
        c.prototype.writeFloatLE = function(e, t, r) {
            return z(this, e, t, !0, r)
        }
        ,
        c.prototype.writeFloatBE = function(e, t, r) {
            return z(this, e, t, !1, r)
        }
        ,
        c.prototype.writeDoubleLE = function(e, t, r) {
            return L(this, e, t, !0, r)
        }
        ,
        c.prototype.writeDoubleBE = function(e, t, r) {
            return L(this, e, t, !1, r)
        }
        ,
        c.prototype.copy = function(e, t, r, n) {
            if (r || (r = 0),
            n || 0 === n || (n = this.length),
            t >= e.length && (t = e.length),
            t || (t = 0),
            n > 0 && n < r && (n = r),
            n === r)
                return 0;
            if (0 === e.length || 0 === this.length)
                return 0;
            if (t < 0)
                throw new RangeError("targetStart out of bounds");
            if (r < 0 || r >= this.length)
                throw new RangeError("sourceStart out of bounds");
            if (n < 0)
                throw new RangeError("sourceEnd out of bounds");
            n > this.length && (n = this.length),
            e.length - t < n - r && (n = e.length - t + r);
            var i, o = n - r;
            if (this === e && r < t && t < n)
                for (i = o - 1; i >= 0; --i)
                    e[i + t] = this[i + r];
            else if (o < 1e3 || !c.TYPED_ARRAY_SUPPORT)
                for (i = 0; i < o; ++i)
                    e[i + t] = this[i + r];
            else
                Uint8Array.prototype.set.call(e, this.subarray(r, r + o), t);
            return o
        }
        ,
        c.prototype.fill = function(e, t, r, n) {
            if ("string" == typeof e) {
                if ("string" == typeof t ? (n = t,
                t = 0,
                r = this.length) : "string" == typeof r && (n = r,
                r = this.length),
                1 === e.length) {
                    var i = e.charCodeAt(0);
                    i < 256 && (e = i)
                }
                if (void 0 !== n && "string" != typeof n)
                    throw new TypeError("encoding must be a string");
                if ("string" == typeof n && !c.isEncoding(n))
                    throw new TypeError("Unknown encoding: " + n)
            } else
                "number" == typeof e && (e &= 255);
            if (t < 0 || this.length < t || this.length < r)
                throw new RangeError("Out of range index");
            if (r <= t)
                return this;
            var o;
            if (t >>>= 0,
            r = void 0 === r ? this.length : r >>> 0,
            e || (e = 0),
            "number" == typeof e)
                for (o = t; o < r; ++o)
                    this[o] = e;
            else {
                var s = c.isBuffer(e) ? e : U(new c(e,n).toString())
                  , a = s.length;
                for (o = 0; o < r - t; ++o)
                    this[o + t] = s[o % a]
            }
            return this
        }
        ;
        var B = /[^+\/0-9A-Za-z-_]/g;
        function F(e) {
            return e < 16 ? "0" + e.toString(16) : e.toString(16)
        }
        function U(e, t) {
            var r;
            t = t || 1 / 0;
            for (var n = e.length, i = null, o = [], s = 0; s < n; ++s) {
                if ((r = e.charCodeAt(s)) > 55295 && r < 57344) {
                    if (!i) {
                        if (r > 56319) {
                            (t -= 3) > -1 && o.push(239, 191, 189);
                            continue
                        }
                        if (s + 1 === n) {
                            (t -= 3) > -1 && o.push(239, 191, 189);
                            continue
                        }
                        i = r;
                        continue
                    }
                    if (r < 56320) {
                        (t -= 3) > -1 && o.push(239, 191, 189),
                        i = r;
                        continue
                    }
                    r = 65536 + (i - 55296 << 10 | r - 56320)
                } else
                    i && (t -= 3) > -1 && o.push(239, 191, 189);
                if (i = null,
                r < 128) {
                    if ((t -= 1) < 0)
                        break;
                    o.push(r)
                } else if (r < 2048) {
                    if ((t -= 2) < 0)
                        break;
                    o.push(r >> 6 | 192, 63 & r | 128)
                } else if (r < 65536) {
                    if ((t -= 3) < 0)
                        break;
                    o.push(r >> 12 | 224, r >> 6 & 63 | 128, 63 & r | 128)
                } else {
                    if (!(r < 1114112))
                        throw new Error("Invalid code point");
                    if ((t -= 4) < 0)
                        break;
                    o.push(r >> 18 | 240, r >> 12 & 63 | 128, r >> 6 & 63 | 128, 63 & r | 128)
                }
            }
            return o
        }
        function q(e) {
            return n.toByteArray(function(e) {
                if ((e = function(e) {
                    return e.trim ? e.trim() : e.replace(/^\s+|\s+$/g, "")
                }(e).replace(B, "")).length < 2)
                    return "";
                for (; e.length % 4 != 0; )
                    e += "=";
                return e
            }(e))
        }
        function H(e, t, r, n) {
            for (var i = 0; i < n && !(i + r >= t.length || i >= e.length); ++i)
                t[i + r] = e[i];
            return i
        }
    }
    ).call(this, r(68))
}
, function(e, t) {
    var r;
    r = function() {
        return this
    }();
    try {
        r = r || new Function("return this")()
    } catch (e) {
        "object" == typeof window && (r = window)
    }
    e.exports = r
}
, function(e, t, r) {
    "use strict";
    t.byteLength = function(e) {
        var t = u(e)
          , r = t[0]
          , n = t[1];
        return 3 * (r + n) / 4 - n
    }
    ,
    t.toByteArray = function(e) {
        var t, r, n = u(e), s = n[0], a = n[1], c = new o(function(e, t, r) {
            return 3 * (t + r) / 4 - r
        }(0, s, a)), p = 0, l = a > 0 ? s - 4 : s;
        for (r = 0; r < l; r += 4)
            t = i[e.charCodeAt(r)] << 18 | i[e.charCodeAt(r + 1)] << 12 | i[e.charCodeAt(r + 2)] << 6 | i[e.charCodeAt(r + 3)],
            c[p++] = t >> 16 & 255,
            c[p++] = t >> 8 & 255,
            c[p++] = 255 & t;
        2 === a && (t = i[e.charCodeAt(r)] << 2 | i[e.charCodeAt(r + 1)] >> 4,
        c[p++] = 255 & t);
        1 === a && (t = i[e.charCodeAt(r)] << 10 | i[e.charCodeAt(r + 1)] << 4 | i[e.charCodeAt(r + 2)] >> 2,
        c[p++] = t >> 8 & 255,
        c[p++] = 255 & t);
        return c
    }
    ,
    t.fromByteArray = function(e) {
        for (var t, r = e.length, i = r % 3, o = [], s = 16383, a = 0, c = r - i; a < c; a += s)
            o.push(p(e, a, a + s > c ? c : a + s));
        1 === i ? (t = e[r - 1],
        o.push(n[t >> 2] + n[t << 4 & 63] + "==")) : 2 === i && (t = (e[r - 2] << 8) + e[r - 1],
        o.push(n[t >> 10] + n[t >> 4 & 63] + n[t << 2 & 63] + "="));
        return o.join("")
    }
    ;
    for (var n = [], i = [], o = "undefined" != typeof Uint8Array ? Uint8Array : Array, s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", a = 0, c = s.length; a < c; ++a)
        n[a] = s[a],
        i[s.charCodeAt(a)] = a;
    function u(e) {
        var t = e.length;
        if (t % 4 > 0)
            throw new Error("Invalid string. Length must be a multiple of 4");
        var r = e.indexOf("=");
        return -1 === r && (r = t),
        [r, r === t ? 0 : 4 - r % 4]
    }
    function p(e, t, r) {
        for (var i, o, s = [], a = t; a < r; a += 3)
            i = (e[a] << 16 & 16711680) + (e[a + 1] << 8 & 65280) + (255 & e[a + 2]),
            s.push(n[(o = i) >> 18 & 63] + n[o >> 12 & 63] + n[o >> 6 & 63] + n[63 & o]);
        return s.join("")
    }
    i["-".charCodeAt(0)] = 62,
    i["_".charCodeAt(0)] = 63
}
, function(e, t) {
    /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
    t.read = function(e, t, r, n, i) {
        var o, s, a = 8 * i - n - 1, c = (1 << a) - 1, u = c >> 1, p = -7, l = r ? i - 1 : 0, f = r ? -1 : 1, h = e[t + l];
        for (l += f,
        o = h & (1 << -p) - 1,
        h >>= -p,
        p += a; p > 0; o = 256 * o + e[t + l],
        l += f,
        p -= 8)
            ;
        for (s = o & (1 << -p) - 1,
        o >>= -p,
        p += n; p > 0; s = 256 * s + e[t + l],
        l += f,
        p -= 8)
            ;
        if (0 === o)
            o = 1 - u;
        else {
            if (o === c)
                return s ? NaN : 1 / 0 * (h ? -1 : 1);
            s += Math.pow(2, n),
            o -= u
        }
        return (h ? -1 : 1) * s * Math.pow(2, o - n)
    }
    ,
    t.write = function(e, t, r, n, i, o) {
        var s, a, c, u = 8 * o - i - 1, p = (1 << u) - 1, l = p >> 1, f = 23 === i ? Math.pow(2, -24) - Math.pow(2, -77) : 0, h = n ? 0 : o - 1, v = n ? 1 : -1, d = t < 0 || 0 === t && 1 / t < 0 ? 1 : 0;
        for (t = Math.abs(t),
        isNaN(t) || t === 1 / 0 ? (a = isNaN(t) ? 1 : 0,
        s = p) : (s = Math.floor(Math.log(t) / Math.LN2),
        t * (c = Math.pow(2, -s)) < 1 && (s--,
        c *= 2),
        (t += s + l >= 1 ? f / c : f * Math.pow(2, 1 - l)) * c >= 2 && (s++,
        c /= 2),
        s + l >= p ? (a = 0,
        s = p) : s + l >= 1 ? (a = (t * c - 1) * Math.pow(2, i),
        s += l) : (a = t * Math.pow(2, l - 1) * Math.pow(2, i),
        s = 0)); i >= 8; e[r + h] = 255 & a,
        h += v,
        a /= 256,
        i -= 8)
            ;
        for (s = s << i | a,
        u += i; u > 0; e[r + h] = 255 & s,
        h += v,
        s /= 256,
        u -= 8)
            ;
        e[r + h - v] |= 128 * d
    }
}
, function(e, t) {
    var r = {}.toString;
    e.exports = Array.isArray || function(e) {
        return "[object Array]" == r.call(e)
    }
}
, function(e, t, r) {
    "use strict";
    var n, i, o = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.AudioStreamFormatImpl = t.AudioStreamFormat = t.AudioFormatTag = void 0,
    function(e) {
        e[e.PCM = 1] = "PCM",
        e[e.MuLaw = 2] = "MuLaw",
        e[e.Siren = 3] = "Siren",
        e[e.MP3 = 4] = "MP3",
        e[e.SILKSkype = 5] = "SILKSkype",
        e[e.OGG_OPUS = 6] = "OGG_OPUS",
        e[e.WEBM_OPUS = 7] = "WEBM_OPUS",
        e[e.ALaw = 8] = "ALaw",
        e[e.FLAC = 9] = "FLAC"
    }(i = t.AudioFormatTag || (t.AudioFormatTag = {}));
    var s = function() {
        function e() {}
        return e.getDefaultInputFormat = function() {
            return a.getDefaultInputFormat()
        }
        ,
        e.getWaveFormatPCM = function(e, t, r) {
            return new a(e,t,r)
        }
        ,
        e
    }();
    t.AudioStreamFormat = s;
    var a = function(e) {
        function t(t, r, n, o) {
            void 0 === t && (t = 16e3),
            void 0 === r && (r = 16),
            void 0 === n && (n = 1),
            void 0 === o && (o = i.PCM);
            var s = e.call(this) || this;
            switch (s.setString = function(e, t, r) {
                for (var n = 0; n < r.length; n++)
                    e.setUint8(t + n, r.charCodeAt(n))
            }
            ,
            o) {
            case i.PCM:
                s.formatTag = 1;
                break;
            case i.ALaw:
                s.formatTag = 6;
                break;
            case i.MuLaw:
                s.formatTag = 7
            }
            s.bitsPerSample = r,
            s.samplesPerSec = t,
            s.channels = n,
            s.avgBytesPerSec = s.samplesPerSec * s.channels * (s.bitsPerSample / 8),
            s.blockAlign = s.channels * Math.max(s.bitsPerSample, 8),
            s.privHeader = new ArrayBuffer(44);
            var a = new DataView(s.privHeader);
            return s.setString(a, 0, "RIFF"),
            a.setUint32(4, 0, !0),
            s.setString(a, 8, "WAVEfmt "),
            a.setUint32(16, 16, !0),
            a.setUint16(20, s.formatTag, !0),
            a.setUint16(22, s.channels, !0),
            a.setUint32(24, s.samplesPerSec, !0),
            a.setUint32(28, s.avgBytesPerSec, !0),
            a.setUint16(32, s.channels * (s.bitsPerSample / 8), !0),
            a.setUint16(34, s.bitsPerSample, !0),
            s.setString(a, 36, "data"),
            a.setUint32(40, 0, !0),
            s
        }
        return o(t, e),
        t.getDefaultInputFormat = function() {
            return new t
        }
        ,
        t.getAudioContext = function(e) {
            var t = window.AudioContext || window.webkitAudioContext || !1;
            if (t)
                return void 0 !== e && navigator.mediaDevices.getSupportedConstraints().sampleRate ? new t({
                    sampleRate: e
                }) : new t;
            throw new Error("Browser does not support Web Audio API (AudioContext is not available).")
        }
        ,
        t.prototype.close = function() {}
        ,
        Object.defineProperty(t.prototype, "header", {
            get: function() {
                return this.privHeader
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(s);
    t.AudioStreamFormatImpl = a
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    ), o = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
    , s = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.PushAudioOutputStreamImpl = t.PushAudioOutputStream = t.PullAudioOutputStreamImpl = t.PullAudioOutputStream = t.AudioOutputStream = void 0;
    var a = r(4)
      , c = r(63)
      , u = r(74)
      , p = function() {
        function e() {}
        return e.createPullStream = function() {
            return l.create()
        }
        ,
        e
    }();
    t.AudioOutputStream = p;
    var l = function(e) {
        function t() {
            return null !== e && e.apply(this, arguments) || this
        }
        return i(t, e),
        t.create = function() {
            return new f
        }
        ,
        t
    }(p);
    t.PullAudioOutputStream = l;
    var f = function(e) {
        function t() {
            var t = e.call(this) || this;
            return t.privId = a.createNoDashGuid(),
            t.privStream = new a.Stream,
            t
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "format", {
            get: function() {
                return this.privFormat
            },
            set: function(e) {
                null == e && (this.privFormat = u.AudioOutputFormatImpl.getDefaultOutputFormat()),
                this.privFormat = e
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "isClosed", {
            get: function() {
                return this.privStream.isClosed
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.id = function() {
            return this.privId
        }
        ,
        t.prototype.read = function(e) {
            return o(this, void 0, void 0, (function() {
                var t, r, n, i;
                return s(this, (function(o) {
                    switch (o.label) {
                    case 0:
                        if (t = new Int8Array(e),
                        r = 0,
                        void 0 !== this.privLastChunkView) {
                            if (this.privLastChunkView.length > e.byteLength)
                                return t.set(this.privLastChunkView.slice(0, e.byteLength)),
                                this.privLastChunkView = this.privLastChunkView.slice(e.byteLength),
                                [2, Promise.resolve(e.byteLength)];
                            t.set(this.privLastChunkView),
                            r = this.privLastChunkView.length,
                            this.privLastChunkView = void 0
                        }
                        o.label = 1;
                    case 1:
                        return r < e.byteLength && !this.privStream.isReadEnded ? [4, this.privStream.read()] : [3, 6];
                    case 2:
                        return void 0 === (n = o.sent()) || n.isEnd ? [3, 3] : (i = void 0,
                        n.buffer.byteLength > e.byteLength - r ? (i = n.buffer.slice(0, e.byteLength - r),
                        this.privLastChunkView = new Int8Array(n.buffer.slice(e.byteLength - r))) : i = n.buffer,
                        t.set(new Int8Array(i), r),
                        r += i.byteLength,
                        [3, 5]);
                    case 3:
                        return [4, this.privStream.readEnded()];
                    case 4:
                        o.sent(),
                        o.label = 5;
                    case 5:
                        return [3, 1];
                    case 6:
                        return [2, r]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.write = function(e) {
            c.Contracts.throwIfNullOrUndefined(this.privStream, "must set format before writing"),
            this.privStream.writeStreamChunk({
                buffer: e,
                isEnd: !1,
                timeReceived: Date.now()
            })
        }
        ,
        t.prototype.close = function() {
            this.privStream.close()
        }
        ,
        t
    }(l);
    t.PullAudioOutputStreamImpl = f;
    var h = function(e) {
        function t() {
            return e.call(this) || this
        }
        return i(t, e),
        t.create = function(e) {
            return new v(e)
        }
        ,
        t
    }(p);
    t.PushAudioOutputStream = h;
    var v = function(e) {
        function t(t) {
            var r = e.call(this) || this;
            return r.privId = a.createNoDashGuid(),
            r.privCallback = t,
            r
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "format", {
            set: function(e) {},
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.write = function(e) {
            this.privCallback.write && this.privCallback.write(e)
        }
        ,
        t.prototype.close = function() {
            this.privCallback.close && this.privCallback.close()
        }
        ,
        t.prototype.id = function() {
            return this.privId
        }
        ,
        t
    }(h);
    t.PushAudioOutputStreamImpl = v
}
, function(e, t, r) {
    "use strict";
    var n, i, o = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.AudioOutputFormatImpl = void 0;
    var s = r(75)
      , a = r(72)
      , c = function(e) {
        function t(t, r, n, i, o, s, a, c, u) {
            var p = e.call(this, n, s, r, t) || this;
            return p.formatTag = t,
            p.avgBytesPerSec = i,
            p.blockAlign = o,
            p.priAudioFormatString = a,
            p.priRequestAudioFormatString = c,
            p.priHasHeader = u,
            p
        }
        return o(t, e),
        t.fromSpeechSynthesisOutputFormat = function(e) {
            return void 0 === e ? t.getDefaultOutputFormat() : t.fromSpeechSynthesisOutputFormatString(t.SpeechSynthesisOutputFormatToString[e])
        }
        ,
        t.fromSpeechSynthesisOutputFormatString = function(e) {
            switch (e) {
            case "raw-8khz-8bit-mono-mulaw":
                return new t(a.AudioFormatTag.MuLaw,1,8e3,8e3,1,8,e,e,!1);
            case "riff-16khz-16kbps-mono-siren":
                return new t(a.AudioFormatTag.Siren,1,16e3,2e3,40,0,e,"audio-16khz-16kbps-mono-siren",!0);
            case "audio-16khz-16kbps-mono-siren":
                return new t(a.AudioFormatTag.Siren,1,16e3,2e3,40,0,e,e,!1);
            case "audio-16khz-32kbitrate-mono-mp3":
                return new t(a.AudioFormatTag.MP3,1,16e3,4096,2,16,e,e,!1);
            case "audio-16khz-128kbitrate-mono-mp3":
                return new t(a.AudioFormatTag.MP3,1,16e3,16384,2,16,e,e,!1);
            case "audio-16khz-64kbitrate-mono-mp3":
                return new t(a.AudioFormatTag.MP3,1,16e3,8192,2,16,e,e,!1);
            case "audio-24khz-48kbitrate-mono-mp3":
                return new t(a.AudioFormatTag.MP3,1,24e3,6144,2,16,e,e,!1);
            case "audio-24khz-96kbitrate-mono-mp3":
                return new t(a.AudioFormatTag.MP3,1,24e3,12288,2,16,e,e,!1);
            case "audio-24khz-160kbitrate-mono-mp3":
                return new t(a.AudioFormatTag.MP3,1,24e3,20480,2,16,e,e,!1);
            case "raw-16khz-16bit-mono-truesilk":
                return new t(a.AudioFormatTag.SILKSkype,1,16e3,32e3,2,16,e,e,!1);
            case "riff-8khz-16bit-mono-pcm":
                return new t(a.AudioFormatTag.PCM,1,8e3,16e3,2,16,e,"raw-8khz-16bit-mono-pcm",!0);
            case "riff-24khz-16bit-mono-pcm":
                return new t(a.AudioFormatTag.PCM,1,24e3,48e3,2,16,e,"raw-24khz-16bit-mono-pcm",!0);
            case "riff-8khz-8bit-mono-mulaw":
                return new t(a.AudioFormatTag.MuLaw,1,8e3,8e3,1,8,e,"raw-8khz-8bit-mono-mulaw",!0);
            case "raw-16khz-16bit-mono-pcm":
                return new t(a.AudioFormatTag.PCM,1,16e3,32e3,2,16,e,"raw-16khz-16bit-mono-pcm",!1);
            case "raw-24khz-16bit-mono-pcm":
                return new t(a.AudioFormatTag.PCM,1,24e3,48e3,2,16,e,"raw-24khz-16bit-mono-pcm",!1);
            case "raw-8khz-16bit-mono-pcm":
                return new t(a.AudioFormatTag.PCM,1,8e3,16e3,2,16,e,"raw-8khz-16bit-mono-pcm",!1);
            case "ogg-16khz-16bit-mono-opus":
                return new t(a.AudioFormatTag.OGG_OPUS,1,16e3,8192,2,16,e,e,!1);
            case "ogg-24khz-16bit-mono-opus":
                return new t(a.AudioFormatTag.OGG_OPUS,1,24e3,8192,2,16,e,e,!1);
            case "raw-48khz-16bit-mono-pcm":
                return new t(a.AudioFormatTag.PCM,1,48e3,96e3,2,16,e,"raw-48khz-16bit-mono-pcm",!1);
            case "riff-48khz-16bit-mono-pcm":
                return new t(a.AudioFormatTag.PCM,1,48e3,96e3,2,16,e,"raw-48khz-16bit-mono-pcm",!0);
            case "audio-48khz-96kbitrate-mono-mp3":
                return new t(a.AudioFormatTag.MP3,1,48e3,12288,2,16,e,e,!1);
            case "audio-48khz-192kbitrate-mono-mp3":
                return new t(a.AudioFormatTag.MP3,1,48e3,24576,2,16,e,e,!1);
            case "ogg-48khz-16bit-mono-opus":
                return new t(a.AudioFormatTag.OGG_OPUS,1,48e3,12e3,2,16,e,e,!1);
            case "webm-16khz-16bit-mono-opus":
                return new t(a.AudioFormatTag.WEBM_OPUS,1,16e3,8e3,2,16,e,e,!1);
            case "webm-24khz-16bit-mono-opus":
                return new t(a.AudioFormatTag.WEBM_OPUS,1,24e3,8e3,2,16,e,e,!1);
            case "webm-24khz-16bit-24kbps-mono-opus":
                return new t(a.AudioFormatTag.WEBM_OPUS,1,24e3,3e3,2,16,e,e,!1);
            case "audio-24khz-16bit-mono-flac":
                return new t(a.AudioFormatTag.FLAC,1,24e3,24e3,2,16,e,e,!1);
            case "audio-48khz-16bit-mono-flac":
                return new t(a.AudioFormatTag.FLAC,1,48e3,3e4,2,16,e,e,!1);
            case "raw-24khz-16bit-mono-truesilk":
                return new t(a.AudioFormatTag.SILKSkype,1,24e3,48e3,2,16,e,e,!1);
            case "raw-8khz-8bit-mono-alaw":
                return new t(a.AudioFormatTag.ALaw,1,8e3,8e3,1,8,e,e,!1);
            case "riff-8khz-8bit-mono-alaw":
                return new t(a.AudioFormatTag.ALaw,1,8e3,8e3,1,8,e,"raw-8khz-8bit-mono-alaw",!0);
            case "riff-16khz-16bit-mono-pcm":
            default:
                return new t(a.AudioFormatTag.PCM,1,16e3,32e3,2,16,"riff-16khz-16bit-mono-pcm","raw-16khz-16bit-mono-pcm",!0)
            }
        }
        ,
        t.getDefaultOutputFormat = function() {
            return t.fromSpeechSynthesisOutputFormatString("undefined" != typeof window ? "audio-24khz-48kbitrate-mono-mp3" : "riff-16khz-16bit-mono-pcm")
        }
        ,
        Object.defineProperty(t.prototype, "hasHeader", {
            get: function() {
                return this.priHasHeader
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "header", {
            get: function() {
                if (this.hasHeader)
                    return this.privHeader
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.updateHeader = function(e) {
            this.priHasHeader && new DataView(this.privHeader).setUint32(40, e, !0)
        }
        ,
        Object.defineProperty(t.prototype, "requestAudioFormatString", {
            get: function() {
                return this.priRequestAudioFormatString
            },
            enumerable: !1,
            configurable: !0
        }),
        t.SpeechSynthesisOutputFormatToString = ((i = {})[s.SpeechSynthesisOutputFormat.Raw8Khz8BitMonoMULaw] = "raw-8khz-8bit-mono-mulaw",
        i[s.SpeechSynthesisOutputFormat.Riff16Khz16KbpsMonoSiren] = "riff-16khz-16kbps-mono-siren",
        i[s.SpeechSynthesisOutputFormat.Audio16Khz16KbpsMonoSiren] = "audio-16khz-16kbps-mono-siren",
        i[s.SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3] = "audio-16khz-32kbitrate-mono-mp3",
        i[s.SpeechSynthesisOutputFormat.Audio16Khz128KBitRateMonoMp3] = "audio-16khz-128kbitrate-mono-mp3",
        i[s.SpeechSynthesisOutputFormat.Audio16Khz64KBitRateMonoMp3] = "audio-16khz-64kbitrate-mono-mp3",
        i[s.SpeechSynthesisOutputFormat.Audio24Khz48KBitRateMonoMp3] = "audio-24khz-48kbitrate-mono-mp3",
        i[s.SpeechSynthesisOutputFormat.Audio24Khz96KBitRateMonoMp3] = "audio-24khz-96kbitrate-mono-mp3",
        i[s.SpeechSynthesisOutputFormat.Audio24Khz160KBitRateMonoMp3] = "audio-24khz-160kbitrate-mono-mp3",
        i[s.SpeechSynthesisOutputFormat.Raw16Khz16BitMonoTrueSilk] = "raw-16khz-16bit-mono-truesilk",
        i[s.SpeechSynthesisOutputFormat.Riff16Khz16BitMonoPcm] = "riff-16khz-16bit-mono-pcm",
        i[s.SpeechSynthesisOutputFormat.Riff8Khz16BitMonoPcm] = "riff-8khz-16bit-mono-pcm",
        i[s.SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm] = "riff-24khz-16bit-mono-pcm",
        i[s.SpeechSynthesisOutputFormat.Riff8Khz8BitMonoMULaw] = "riff-8khz-8bit-mono-mulaw",
        i[s.SpeechSynthesisOutputFormat.Raw16Khz16BitMonoPcm] = "raw-16khz-16bit-mono-pcm",
        i[s.SpeechSynthesisOutputFormat.Raw24Khz16BitMonoPcm] = "raw-24khz-16bit-mono-pcm",
        i[s.SpeechSynthesisOutputFormat.Raw8Khz16BitMonoPcm] = "raw-8khz-16bit-mono-pcm",
        i[s.SpeechSynthesisOutputFormat.Ogg16Khz16BitMonoOpus] = "ogg-16khz-16bit-mono-opus",
        i[s.SpeechSynthesisOutputFormat.Ogg24Khz16BitMonoOpus] = "ogg-24khz-16bit-mono-opus",
        i[s.SpeechSynthesisOutputFormat.Raw48Khz16BitMonoPcm] = "raw-48khz-16bit-mono-pcm",
        i[s.SpeechSynthesisOutputFormat.Riff48Khz16BitMonoPcm] = "riff-48khz-16bit-mono-pcm",
        i[s.SpeechSynthesisOutputFormat.Audio48Khz96KBitRateMonoMp3] = "audio-48khz-96kbitrate-mono-mp3",
        i[s.SpeechSynthesisOutputFormat.Audio48Khz192KBitRateMonoMp3] = "audio-48khz-192kbitrate-mono-mp3",
        i[s.SpeechSynthesisOutputFormat.Ogg48Khz16BitMonoOpus] = "ogg-48khz-16bit-mono-opus",
        i[s.SpeechSynthesisOutputFormat.Webm16Khz16BitMonoOpus] = "webm-16khz-16bit-mono-opus",
        i[s.SpeechSynthesisOutputFormat.Webm24Khz16BitMonoOpus] = "webm-24khz-16bit-mono-opus",
        i[s.SpeechSynthesisOutputFormat.Webm24Khz16Bit24KbpsMonoOpus] = "webm-24khz-16bit-24kbps-mono-opus",
        i[s.SpeechSynthesisOutputFormat.Raw24Khz16BitMonoTrueSilk] = "raw-24khz-16bit-mono-truesilk",
        i[s.SpeechSynthesisOutputFormat.Raw8Khz8BitMonoALaw] = "raw-8khz-8bit-mono-alaw",
        i[s.SpeechSynthesisOutputFormat.Riff8Khz8BitMonoALaw] = "riff-8khz-8bit-mono-alaw",
        i),
        t
    }(a.AudioStreamFormatImpl);
    t.AudioOutputFormatImpl = c
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeechSynthesisOutputFormat = void 0,
    function(e) {
        e[e.Raw8Khz8BitMonoMULaw = 0] = "Raw8Khz8BitMonoMULaw",
        e[e.Riff16Khz16KbpsMonoSiren = 1] = "Riff16Khz16KbpsMonoSiren",
        e[e.Audio16Khz16KbpsMonoSiren = 2] = "Audio16Khz16KbpsMonoSiren",
        e[e.Audio16Khz32KBitRateMonoMp3 = 3] = "Audio16Khz32KBitRateMonoMp3",
        e[e.Audio16Khz128KBitRateMonoMp3 = 4] = "Audio16Khz128KBitRateMonoMp3",
        e[e.Audio16Khz64KBitRateMonoMp3 = 5] = "Audio16Khz64KBitRateMonoMp3",
        e[e.Audio24Khz48KBitRateMonoMp3 = 6] = "Audio24Khz48KBitRateMonoMp3",
        e[e.Audio24Khz96KBitRateMonoMp3 = 7] = "Audio24Khz96KBitRateMonoMp3",
        e[e.Audio24Khz160KBitRateMonoMp3 = 8] = "Audio24Khz160KBitRateMonoMp3",
        e[e.Raw16Khz16BitMonoTrueSilk = 9] = "Raw16Khz16BitMonoTrueSilk",
        e[e.Riff16Khz16BitMonoPcm = 10] = "Riff16Khz16BitMonoPcm",
        e[e.Riff8Khz16BitMonoPcm = 11] = "Riff8Khz16BitMonoPcm",
        e[e.Riff24Khz16BitMonoPcm = 12] = "Riff24Khz16BitMonoPcm",
        e[e.Riff8Khz8BitMonoMULaw = 13] = "Riff8Khz8BitMonoMULaw",
        e[e.Raw16Khz16BitMonoPcm = 14] = "Raw16Khz16BitMonoPcm",
        e[e.Raw24Khz16BitMonoPcm = 15] = "Raw24Khz16BitMonoPcm",
        e[e.Raw8Khz16BitMonoPcm = 16] = "Raw8Khz16BitMonoPcm",
        e[e.Ogg16Khz16BitMonoOpus = 17] = "Ogg16Khz16BitMonoOpus",
        e[e.Ogg24Khz16BitMonoOpus = 18] = "Ogg24Khz16BitMonoOpus",
        e[e.Raw48Khz16BitMonoPcm = 19] = "Raw48Khz16BitMonoPcm",
        e[e.Riff48Khz16BitMonoPcm = 20] = "Riff48Khz16BitMonoPcm",
        e[e.Audio48Khz96KBitRateMonoMp3 = 21] = "Audio48Khz96KBitRateMonoMp3",
        e[e.Audio48Khz192KBitRateMonoMp3 = 22] = "Audio48Khz192KBitRateMonoMp3",
        e[e.Ogg48Khz16BitMonoOpus = 23] = "Ogg48Khz16BitMonoOpus",
        e[e.Webm16Khz16BitMonoOpus = 24] = "Webm16Khz16BitMonoOpus",
        e[e.Webm24Khz16BitMonoOpus = 25] = "Webm24Khz16BitMonoOpus",
        e[e.Raw24Khz16BitMonoTrueSilk = 26] = "Raw24Khz16BitMonoTrueSilk",
        e[e.Raw8Khz8BitMonoALaw = 27] = "Raw8Khz8BitMonoALaw",
        e[e.Riff8Khz8BitMonoALaw = 28] = "Riff8Khz8BitMonoALaw",
        e[e.Webm24Khz16Bit24KbpsMonoOpus = 29] = "Webm24Khz16Bit24KbpsMonoOpus"
    }(t.SpeechSynthesisOutputFormat || (t.SpeechSynthesisOutputFormat = {}))
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.CancellationReason = void 0,
    function(e) {
        e[e.Error = 0] = "Error",
        e[e.EndOfStream = 1] = "EndOfStream"
    }(t.CancellationReason || (t.CancellationReason = {}))
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.PullAudioInputStreamCallback = void 0;
    var n = function() {};
    t.PullAudioInputStreamCallback = n
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.PushAudioOutputStreamCallback = void 0;
    var n = function() {};
    t.PushAudioOutputStreamCallback = n
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.KeywordRecognitionModel = void 0;
    var n = r(63)
      , i = function() {
        function e() {
            this.privDisposed = !1
        }
        return e.fromFile = function(e) {
            throw n.Contracts.throwIfFileDoesNotExist(e, "fileName"),
            new Error("Not yet implemented.")
        }
        ,
        e.fromStream = function(e) {
            throw n.Contracts.throwIfNull(e, "file"),
            new Error("Not yet implemented.")
        }
        ,
        e.prototype.close = function() {
            this.privDisposed || (this.privDisposed = !0)
        }
        ,
        e
    }();
    t.KeywordRecognitionModel = i
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SessionEventArgs = void 0;
    var n = function() {
        function e(e) {
            this.privSessionId = e
        }
        return Object.defineProperty(e.prototype, "sessionId", {
            get: function() {
                return this.privSessionId
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.SessionEventArgs = n
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.RecognitionEventArgs = void 0;
    var o = function(e) {
        function t(t, r) {
            var n = e.call(this, r) || this;
            return n.privOffset = t,
            n
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "offset", {
            get: function() {
                return this.privOffset
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(r(61).SessionEventArgs);
    t.RecognitionEventArgs = o
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.OutputFormat = void 0,
    function(e) {
        e[e.Simple = 0] = "Simple",
        e[e.Detailed = 1] = "Detailed"
    }(t.OutputFormat || (t.OutputFormat = {}))
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.IntentRecognitionEventArgs = void 0;
    var o = function(e) {
        function t(t, r, n) {
            var i = e.call(this, r, n) || this;
            return i.privResult = t,
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "result", {
            get: function() {
                return this.privResult
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(r(61).RecognitionEventArgs);
    t.IntentRecognitionEventArgs = o
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.RecognitionResult = void 0;
    var n = function() {
        function e(e, t, r, n, i, o, s, a, c, u) {
            this.privResultId = e,
            this.privReason = t,
            this.privText = r,
            this.privDuration = n,
            this.privOffset = i,
            this.privLanguage = o,
            this.privLanguageDetectionConfidence = s,
            this.privErrorDetails = a,
            this.privJson = c,
            this.privProperties = u
        }
        return Object.defineProperty(e.prototype, "resultId", {
            get: function() {
                return this.privResultId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "reason", {
            get: function() {
                return this.privReason
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "text", {
            get: function() {
                return this.privText
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "duration", {
            get: function() {
                return this.privDuration
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "offset", {
            get: function() {
                return this.privOffset
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "language", {
            get: function() {
                return this.privLanguage
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "languageDetectionConfidence", {
            get: function() {
                return this.privLanguageDetectionConfidence
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "errorDetails", {
            get: function() {
                return this.privErrorDetails
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "json", {
            get: function() {
                return this.privJson
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.RecognitionResult = n
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeechRecognitionResult = void 0;
    var o = function(e) {
        function t(t, r, n, i, o, s, a, c, u, p, l) {
            var f = e.call(this, t, r, n, i, o, s, a, u, p, l) || this;
            return f.privSpeakerId = c,
            f
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "speakerId", {
            get: function() {
                return this.privSpeakerId
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(r(61).RecognitionResult);
    t.SpeechRecognitionResult = o
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.IntentRecognitionResult = void 0;
    var o = function(e) {
        function t(t, r, n, i, o, s, a, c, u, p, l) {
            var f = e.call(this, r, n, i, o, s, a, c, void 0, u, p, l) || this;
            return f.privIntentId = t,
            f
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "intentId", {
            get: function() {
                return this.privIntentId
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(r(61).SpeechRecognitionResult);
    t.IntentRecognitionResult = o
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.LanguageUnderstandingModelImpl = t.LanguageUnderstandingModel = void 0;
    var o = r(63)
      , s = function() {
        function e() {}
        return e.fromEndpoint = function(e) {
            o.Contracts.throwIfNull(e, "uri"),
            o.Contracts.throwIfNullOrWhitespace(e.hostname, "uri");
            var t = new a
              , r = e.host.indexOf(".");
            if (-1 === r)
                throw new Error("Could not determine region from endpoint");
            t.region = e.host.substr(0, r);
            var n = e.pathname.lastIndexOf("/") + 1;
            if (-1 === n)
                throw new Error("Could not determine appId from endpoint");
            if (t.appId = e.pathname.substr(n),
            t.subscriptionKey = e.searchParams.get("subscription-key"),
            void 0 === t.subscriptionKey)
                throw new Error("Could not determine subscription key from endpoint");
            return t
        }
        ,
        e.fromAppId = function(e) {
            o.Contracts.throwIfNullOrWhitespace(e, "appId");
            var t = new a;
            return t.appId = e,
            t
        }
        ,
        e.fromSubscription = function(e, t, r) {
            o.Contracts.throwIfNullOrWhitespace(e, "subscriptionKey"),
            o.Contracts.throwIfNullOrWhitespace(t, "appId"),
            o.Contracts.throwIfNullOrWhitespace(r, "region");
            var n = new a;
            return n.appId = t,
            n.region = r,
            n.subscriptionKey = e,
            n
        }
        ,
        e
    }();
    t.LanguageUnderstandingModel = s;
    var a = function(e) {
        function t() {
            return null !== e && e.apply(this, arguments) || this
        }
        return i(t, e),
        t
    }(s);
    t.LanguageUnderstandingModelImpl = a
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConversationTranscriptionEventArgs = t.SpeechRecognitionEventArgs = void 0;
    var o = function(e) {
        function t(t, r, n) {
            var i = e.call(this, r, n) || this;
            return i.privResult = t,
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "result", {
            get: function() {
                return this.privResult
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(r(61).RecognitionEventArgs);
    t.SpeechRecognitionEventArgs = o;
    var s = function(e) {
        function t() {
            return null !== e && e.apply(this, arguments) || this
        }
        return i(t, e),
        t
    }(o);
    t.ConversationTranscriptionEventArgs = s
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeechRecognitionCanceledEventArgs = void 0;
    var o = function(e) {
        function t() {
            return null !== e && e.apply(this, arguments) || this
        }
        return i(t, e),
        t
    }(r(90).CancellationEventArgsBase);
    t.SpeechRecognitionCanceledEventArgs = o
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.CancellationEventArgsBase = void 0;
    var o = function(e) {
        function t(t, r, n, i, o) {
            var s = e.call(this, i, o) || this;
            return s.privReason = t,
            s.privErrorDetails = r,
            s.privErrorCode = n,
            s
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "reason", {
            get: function() {
                return this.privReason
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "errorCode", {
            get: function() {
                return this.privErrorCode
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "errorDetails", {
            get: function() {
                return this.privErrorDetails
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(r(61).RecognitionEventArgs);
    t.CancellationEventArgsBase = o
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.TranslationRecognitionEventArgs = void 0;
    var o = function(e) {
        function t(t, r, n) {
            var i = e.call(this, r, n) || this;
            return i.privResult = t,
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "result", {
            get: function() {
                return this.privResult
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(r(61).RecognitionEventArgs);
    t.TranslationRecognitionEventArgs = o
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.TranslationSynthesisEventArgs = void 0;
    var o = function(e) {
        function t(t, r) {
            var n = e.call(this, r) || this;
            return n.privResult = t,
            n
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "result", {
            get: function() {
                return this.privResult
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(r(61).SessionEventArgs);
    t.TranslationSynthesisEventArgs = o
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.TranslationRecognitionResult = void 0;
    var o = function(e) {
        function t(t, r, n, i, o, s, a, c, u) {
            var p = e.call(this, r, n, i, o, s, void 0, void 0, void 0, a, c, u) || this;
            return p.privTranslations = t,
            p
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "translations", {
            get: function() {
                return this.privTranslations
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(r(61).SpeechRecognitionResult);
    t.TranslationRecognitionResult = o
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.TranslationSynthesisResult = void 0;
    var n = function() {
        function e(e, t) {
            this.privReason = e,
            this.privAudio = t
        }
        return Object.defineProperty(e.prototype, "audio", {
            get: function() {
                return this.privAudio
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "reason", {
            get: function() {
                return this.privReason
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.TranslationSynthesisResult = n
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ResultReason = void 0,
    function(e) {
        e[e.NoMatch = 0] = "NoMatch",
        e[e.Canceled = 1] = "Canceled",
        e[e.RecognizingSpeech = 2] = "RecognizingSpeech",
        e[e.RecognizedSpeech = 3] = "RecognizedSpeech",
        e[e.RecognizedKeyword = 4] = "RecognizedKeyword",
        e[e.RecognizingIntent = 5] = "RecognizingIntent",
        e[e.RecognizedIntent = 6] = "RecognizedIntent",
        e[e.TranslatingSpeech = 7] = "TranslatingSpeech",
        e[e.TranslatedSpeech = 8] = "TranslatedSpeech",
        e[e.SynthesizingAudio = 9] = "SynthesizingAudio",
        e[e.SynthesizingAudioCompleted = 10] = "SynthesizingAudioCompleted",
        e[e.SynthesizingAudioStarted = 11] = "SynthesizingAudioStarted",
        e[e.EnrollingVoiceProfile = 12] = "EnrollingVoiceProfile",
        e[e.EnrolledVoiceProfile = 13] = "EnrolledVoiceProfile",
        e[e.RecognizedSpeakers = 14] = "RecognizedSpeakers",
        e[e.RecognizedSpeaker = 15] = "RecognizedSpeaker",
        e[e.ResetVoiceProfile = 16] = "ResetVoiceProfile",
        e[e.DeletedVoiceProfile = 17] = "DeletedVoiceProfile"
    }(t.ResultReason || (t.ResultReason = {}))
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeechConfigImpl = t.SpeechConfig = void 0;
    var o = r(53)
      , s = r(63)
      , a = r(61)
      , c = function() {
        function e() {}
        return e.fromSubscription = function(e, t) {
            s.Contracts.throwIfNullOrWhitespace(e, "subscriptionKey"),
            s.Contracts.throwIfNullOrWhitespace(t, "region");
            var r = new u;
            return r.setProperty(a.PropertyId.SpeechServiceConnection_Region, t),
            r.setProperty(a.PropertyId.SpeechServiceConnection_IntentRegion, t),
            r.setProperty(a.PropertyId.SpeechServiceConnection_Key, e),
            r
        }
        ,
        e.fromEndpoint = function(e, t) {
            s.Contracts.throwIfNull(e, "endpoint");
            var r = new u;
            return r.setProperty(a.PropertyId.SpeechServiceConnection_Endpoint, e.href),
            void 0 !== t && r.setProperty(a.PropertyId.SpeechServiceConnection_Key, t),
            r
        }
        ,
        e.fromHost = function(e, t) {
            s.Contracts.throwIfNull(e, "hostName");
            var r = new u;
            return r.setProperty(a.PropertyId.SpeechServiceConnection_Host, e.protocol + "//" + e.hostname + ("" === e.port ? "" : ":" + e.port)),
            void 0 !== t && r.setProperty(a.PropertyId.SpeechServiceConnection_Key, t),
            r
        }
        ,
        e.fromAuthorizationToken = function(e, t) {
            s.Contracts.throwIfNull(e, "authorizationToken"),
            s.Contracts.throwIfNullOrWhitespace(t, "region");
            var r = new u;
            return r.setProperty(a.PropertyId.SpeechServiceConnection_Region, t),
            r.setProperty(a.PropertyId.SpeechServiceConnection_IntentRegion, t),
            r.authorizationToken = e,
            r
        }
        ,
        e.prototype.close = function() {}
        ,
        e
    }();
    t.SpeechConfig = c;
    var u = function(e) {
        function t() {
            var t = e.call(this) || this;
            return t.privProperties = new a.PropertyCollection,
            t.speechRecognitionLanguage = "en-US",
            t.outputFormat = a.OutputFormat.Simple,
            t
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "endPoint", {
            get: function() {
                return new URL(this.privProperties.getProperty(a.PropertyId.SpeechServiceConnection_Endpoint))
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "subscriptionKey", {
            get: function() {
                return this.privProperties.getProperty(a.PropertyId.SpeechServiceConnection_Key)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "region", {
            get: function() {
                return this.privProperties.getProperty(a.PropertyId.SpeechServiceConnection_Region)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "authorizationToken", {
            get: function() {
                return this.privProperties.getProperty(a.PropertyId.SpeechServiceAuthorization_Token)
            },
            set: function(e) {
                this.privProperties.setProperty(a.PropertyId.SpeechServiceAuthorization_Token, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "speechRecognitionLanguage", {
            get: function() {
                return this.privProperties.getProperty(a.PropertyId.SpeechServiceConnection_RecoLanguage)
            },
            set: function(e) {
                this.privProperties.setProperty(a.PropertyId.SpeechServiceConnection_RecoLanguage, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "autoDetectSourceLanguages", {
            get: function() {
                return this.privProperties.getProperty(a.PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages)
            },
            set: function(e) {
                this.privProperties.setProperty(a.PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "outputFormat", {
            get: function() {
                return a.OutputFormat[this.privProperties.getProperty(o.OutputFormatPropertyName, void 0)]
            },
            set: function(e) {
                this.privProperties.setProperty(o.OutputFormatPropertyName, a.OutputFormat[e])
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "endpointId", {
            get: function() {
                return this.privProperties.getProperty(a.PropertyId.SpeechServiceConnection_EndpointId)
            },
            set: function(e) {
                this.privProperties.setProperty(a.PropertyId.SpeechServiceConnection_EndpointId, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.setProperty = function(e, t) {
            s.Contracts.throwIfNull(t, "value"),
            this.privProperties.setProperty(e, t)
        }
        ,
        t.prototype.getProperty = function(e, t) {
            return this.privProperties.getProperty(e, t)
        }
        ,
        t.prototype.setProxy = function(e, t, r, n) {
            this.setProperty(a.PropertyId[a.PropertyId.SpeechServiceConnection_ProxyHostName], e),
            this.setProperty(a.PropertyId[a.PropertyId.SpeechServiceConnection_ProxyPort], t),
            this.setProperty(a.PropertyId[a.PropertyId.SpeechServiceConnection_ProxyUserName], r),
            this.setProperty(a.PropertyId[a.PropertyId.SpeechServiceConnection_ProxyPassword], n)
        }
        ,
        t.prototype.setServiceProperty = function(e, t, r) {
            var n = JSON.parse(this.privProperties.getProperty(o.ServicePropertiesPropertyName, "{}"));
            n[e] = t,
            this.privProperties.setProperty(o.ServicePropertiesPropertyName, JSON.stringify(n))
        }
        ,
        t.prototype.setProfanity = function(e) {
            this.privProperties.setProperty(a.PropertyId.SpeechServiceResponse_ProfanityOption, a.ProfanityOption[e])
        }
        ,
        t.prototype.enableAudioLogging = function() {
            this.privProperties.setProperty(a.PropertyId.SpeechServiceConnection_EnableAudioLogging, "true")
        }
        ,
        t.prototype.requestWordLevelTimestamps = function() {
            this.privProperties.setProperty(a.PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, "true")
        }
        ,
        t.prototype.enableDictation = function() {
            this.privProperties.setProperty(o.ForceDictationPropertyName, "true")
        }
        ,
        t.prototype.clone = function() {
            var e = new t;
            return e.privProperties = this.privProperties.clone(),
            e
        }
        ,
        Object.defineProperty(t.prototype, "speechSynthesisLanguage", {
            get: function() {
                return this.privProperties.getProperty(a.PropertyId.SpeechServiceConnection_SynthLanguage)
            },
            set: function(e) {
                this.privProperties.setProperty(a.PropertyId.SpeechServiceConnection_SynthLanguage, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "speechSynthesisVoiceName", {
            get: function() {
                return this.privProperties.getProperty(a.PropertyId.SpeechServiceConnection_SynthVoice)
            },
            set: function(e) {
                this.privProperties.setProperty(a.PropertyId.SpeechServiceConnection_SynthVoice, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "speechSynthesisOutputFormat", {
            get: function() {
                return a.SpeechSynthesisOutputFormat[this.privProperties.getProperty(a.PropertyId.SpeechServiceConnection_SynthOutputFormat, void 0)]
            },
            set: function(e) {
                this.privProperties.setProperty(a.PropertyId.SpeechServiceConnection_SynthOutputFormat, a.SpeechSynthesisOutputFormat[e])
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(c);
    t.SpeechConfigImpl = u
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeechTranslationConfigImpl = t.SpeechTranslationConfig = void 0;
    var o = r(53)
      , s = r(63)
      , a = r(61)
      , c = function(e) {
        function t() {
            return e.call(this) || this
        }
        return i(t, e),
        t.fromSubscription = function(e, t) {
            s.Contracts.throwIfNullOrWhitespace(e, "subscriptionKey"),
            s.Contracts.throwIfNullOrWhitespace(t, "region");
            var r = new u;
            return r.properties.setProperty(a.PropertyId.SpeechServiceConnection_Key, e),
            r.properties.setProperty(a.PropertyId.SpeechServiceConnection_Region, t),
            r
        }
        ,
        t.fromAuthorizationToken = function(e, t) {
            s.Contracts.throwIfNullOrWhitespace(e, "authorizationToken"),
            s.Contracts.throwIfNullOrWhitespace(t, "region");
            var r = new u;
            return r.properties.setProperty(a.PropertyId.SpeechServiceAuthorization_Token, e),
            r.properties.setProperty(a.PropertyId.SpeechServiceConnection_Region, t),
            r
        }
        ,
        t.fromHost = function(e, t) {
            s.Contracts.throwIfNull(e, "hostName");
            var r = new u;
            return r.setProperty(a.PropertyId.SpeechServiceConnection_Host, e.protocol + "//" + e.hostname + ("" === e.port ? "" : ":" + e.port)),
            void 0 !== t && r.setProperty(a.PropertyId.SpeechServiceConnection_Key, t),
            r
        }
        ,
        t.fromEndpoint = function(e, t) {
            s.Contracts.throwIfNull(e, "endpoint"),
            s.Contracts.throwIfNull(t, "subscriptionKey");
            var r = new u;
            return r.properties.setProperty(a.PropertyId.SpeechServiceConnection_Endpoint, e.href),
            r.properties.setProperty(a.PropertyId.SpeechServiceConnection_Key, t),
            r
        }
        ,
        t
    }(a.SpeechConfig);
    t.SpeechTranslationConfig = c;
    var u = function(e) {
        function t() {
            var t = e.call(this) || this;
            return t.privSpeechProperties = new a.PropertyCollection,
            t.outputFormat = a.OutputFormat.Simple,
            t
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "authorizationToken", {
            set: function(e) {
                s.Contracts.throwIfNullOrWhitespace(e, "value"),
                this.privSpeechProperties.setProperty(a.PropertyId.SpeechServiceAuthorization_Token, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "speechRecognitionLanguage", {
            get: function() {
                return this.privSpeechProperties.getProperty(a.PropertyId[a.PropertyId.SpeechServiceConnection_RecoLanguage])
            },
            set: function(e) {
                s.Contracts.throwIfNullOrWhitespace(e, "value"),
                this.privSpeechProperties.setProperty(a.PropertyId.SpeechServiceConnection_RecoLanguage, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "subscriptionKey", {
            get: function() {
                return this.privSpeechProperties.getProperty(a.PropertyId[a.PropertyId.SpeechServiceConnection_Key])
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "outputFormat", {
            get: function() {
                return a.OutputFormat[this.privSpeechProperties.getProperty(o.OutputFormatPropertyName, void 0)]
            },
            set: function(e) {
                this.privSpeechProperties.setProperty(o.OutputFormatPropertyName, a.OutputFormat[e])
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "endpointId", {
            get: function() {
                return this.privSpeechProperties.getProperty(a.PropertyId.SpeechServiceConnection_EndpointId)
            },
            set: function(e) {
                this.privSpeechProperties.setProperty(a.PropertyId.SpeechServiceConnection_EndpointId, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.addTargetLanguage = function(e) {
            s.Contracts.throwIfNullOrWhitespace(e, "value");
            var t = this.targetLanguages;
            t.push(e),
            this.privSpeechProperties.setProperty(a.PropertyId.SpeechServiceConnection_TranslationToLanguages, t.join(","))
        }
        ,
        Object.defineProperty(t.prototype, "targetLanguages", {
            get: function() {
                return void 0 !== this.privSpeechProperties.getProperty(a.PropertyId.SpeechServiceConnection_TranslationToLanguages, void 0) ? this.privSpeechProperties.getProperty(a.PropertyId.SpeechServiceConnection_TranslationToLanguages).split(",") : []
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "voiceName", {
            get: function() {
                return this.getProperty(a.PropertyId[a.PropertyId.SpeechServiceConnection_TranslationVoice])
            },
            set: function(e) {
                s.Contracts.throwIfNullOrWhitespace(e, "value"),
                this.privSpeechProperties.setProperty(a.PropertyId.SpeechServiceConnection_TranslationVoice, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "region", {
            get: function() {
                return this.privSpeechProperties.getProperty(a.PropertyId.SpeechServiceConnection_Region)
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.setProxy = function(e, t, r, n) {
            this.setProperty(a.PropertyId[a.PropertyId.SpeechServiceConnection_ProxyHostName], e),
            this.setProperty(a.PropertyId[a.PropertyId.SpeechServiceConnection_ProxyPort], t),
            this.setProperty(a.PropertyId[a.PropertyId.SpeechServiceConnection_ProxyUserName], r),
            this.setProperty(a.PropertyId[a.PropertyId.SpeechServiceConnection_ProxyPassword], n)
        }
        ,
        t.prototype.getProperty = function(e, t) {
            return this.privSpeechProperties.getProperty(e, t)
        }
        ,
        t.prototype.setProperty = function(e, t) {
            this.privSpeechProperties.setProperty(e, t)
        }
        ,
        Object.defineProperty(t.prototype, "properties", {
            get: function() {
                return this.privSpeechProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.close = function() {}
        ,
        t.prototype.setServiceProperty = function(e, t, r) {
            var n = JSON.parse(this.privSpeechProperties.getProperty(o.ServicePropertiesPropertyName, "{}"));
            n[e] = t,
            this.privSpeechProperties.setProperty(o.ServicePropertiesPropertyName, JSON.stringify(n))
        }
        ,
        t.prototype.setProfanity = function(e) {
            this.privSpeechProperties.setProperty(a.PropertyId.SpeechServiceResponse_ProfanityOption, a.ProfanityOption[e])
        }
        ,
        t.prototype.enableAudioLogging = function() {
            this.privSpeechProperties.setProperty(a.PropertyId.SpeechServiceConnection_EnableAudioLogging, "true")
        }
        ,
        t.prototype.requestWordLevelTimestamps = function() {
            this.privSpeechProperties.setProperty(a.PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, "true")
        }
        ,
        t.prototype.enableDictation = function() {
            this.privSpeechProperties.setProperty(o.ForceDictationPropertyName, "true")
        }
        ,
        Object.defineProperty(t.prototype, "speechSynthesisLanguage", {
            get: function() {
                return this.privSpeechProperties.getProperty(a.PropertyId.SpeechServiceConnection_SynthLanguage)
            },
            set: function(e) {
                this.privSpeechProperties.setProperty(a.PropertyId.SpeechServiceConnection_SynthLanguage, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "speechSynthesisVoiceName", {
            get: function() {
                return this.privSpeechProperties.getProperty(a.PropertyId.SpeechServiceConnection_SynthVoice)
            },
            set: function(e) {
                this.privSpeechProperties.setProperty(a.PropertyId.SpeechServiceConnection_SynthVoice, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "speechSynthesisOutputFormat", {
            get: function() {
                return a.SpeechSynthesisOutputFormat[this.privSpeechProperties.getProperty(a.PropertyId.SpeechServiceConnection_SynthOutputFormat, void 0)]
            },
            set: function(e) {
                this.privSpeechProperties.setProperty(a.PropertyId.SpeechServiceConnection_SynthOutputFormat, a.SpeechSynthesisOutputFormat[e])
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(c);
    t.SpeechTranslationConfigImpl = u
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.PropertyCollection = void 0;
    var n = r(61)
      , i = function() {
        function e() {
            this.privKeys = [],
            this.privValues = []
        }
        return e.prototype.getProperty = function(e, t) {
            var r;
            r = "string" == typeof e ? e : n.PropertyId[e];
            for (var i = 0; i < this.privKeys.length; i++)
                if (this.privKeys[i] === r)
                    return this.privValues[i];
            return t
        }
        ,
        e.prototype.setProperty = function(e, t) {
            var r;
            r = "string" == typeof e ? e : n.PropertyId[e];
            for (var i = 0; i < this.privKeys.length; i++)
                if (this.privKeys[i] === r)
                    return void (this.privValues[i] = t);
            this.privKeys.push(r),
            this.privValues.push(t)
        }
        ,
        e.prototype.clone = function() {
            for (var t = new e, r = 0; r < this.privKeys.length; r++)
                t.privKeys.push(this.privKeys[r]),
                t.privValues.push(this.privValues[r]);
            return t
        }
        ,
        e.prototype.mergeTo = function(e) {
            var t = this;
            this.privKeys.forEach((function(r) {
                if (void 0 === e.getProperty(r, void 0)) {
                    var n = t.getProperty(r);
                    e.setProperty(r, n)
                }
            }
            ))
        }
        ,
        Object.defineProperty(e.prototype, "keys", {
            get: function() {
                return this.privKeys
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.PropertyCollection = i
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.PropertyId = void 0,
    function(e) {
        e[e.SpeechServiceConnection_Key = 0] = "SpeechServiceConnection_Key",
        e[e.SpeechServiceConnection_Endpoint = 1] = "SpeechServiceConnection_Endpoint",
        e[e.SpeechServiceConnection_Region = 2] = "SpeechServiceConnection_Region",
        e[e.SpeechServiceAuthorization_Token = 3] = "SpeechServiceAuthorization_Token",
        e[e.SpeechServiceAuthorization_Type = 4] = "SpeechServiceAuthorization_Type",
        e[e.SpeechServiceConnection_EndpointId = 5] = "SpeechServiceConnection_EndpointId",
        e[e.SpeechServiceConnection_TranslationToLanguages = 6] = "SpeechServiceConnection_TranslationToLanguages",
        e[e.SpeechServiceConnection_TranslationVoice = 7] = "SpeechServiceConnection_TranslationVoice",
        e[e.SpeechServiceConnection_TranslationFeatures = 8] = "SpeechServiceConnection_TranslationFeatures",
        e[e.SpeechServiceConnection_IntentRegion = 9] = "SpeechServiceConnection_IntentRegion",
        e[e.SpeechServiceConnection_ProxyHostName = 10] = "SpeechServiceConnection_ProxyHostName",
        e[e.SpeechServiceConnection_ProxyPort = 11] = "SpeechServiceConnection_ProxyPort",
        e[e.SpeechServiceConnection_ProxyUserName = 12] = "SpeechServiceConnection_ProxyUserName",
        e[e.SpeechServiceConnection_ProxyPassword = 13] = "SpeechServiceConnection_ProxyPassword",
        e[e.SpeechServiceConnection_RecoMode = 14] = "SpeechServiceConnection_RecoMode",
        e[e.SpeechServiceConnection_RecoLanguage = 15] = "SpeechServiceConnection_RecoLanguage",
        e[e.Speech_SessionId = 16] = "Speech_SessionId",
        e[e.SpeechServiceConnection_SynthLanguage = 17] = "SpeechServiceConnection_SynthLanguage",
        e[e.SpeechServiceConnection_SynthVoice = 18] = "SpeechServiceConnection_SynthVoice",
        e[e.SpeechServiceConnection_SynthOutputFormat = 19] = "SpeechServiceConnection_SynthOutputFormat",
        e[e.SpeechServiceConnection_AutoDetectSourceLanguages = 20] = "SpeechServiceConnection_AutoDetectSourceLanguages",
        e[e.SpeechServiceResponse_RequestDetailedResultTrueFalse = 21] = "SpeechServiceResponse_RequestDetailedResultTrueFalse",
        e[e.SpeechServiceResponse_RequestProfanityFilterTrueFalse = 22] = "SpeechServiceResponse_RequestProfanityFilterTrueFalse",
        e[e.SpeechServiceResponse_JsonResult = 23] = "SpeechServiceResponse_JsonResult",
        e[e.SpeechServiceResponse_JsonErrorDetails = 24] = "SpeechServiceResponse_JsonErrorDetails",
        e[e.CancellationDetails_Reason = 25] = "CancellationDetails_Reason",
        e[e.CancellationDetails_ReasonText = 26] = "CancellationDetails_ReasonText",
        e[e.CancellationDetails_ReasonDetailedText = 27] = "CancellationDetails_ReasonDetailedText",
        e[e.LanguageUnderstandingServiceResponse_JsonResult = 28] = "LanguageUnderstandingServiceResponse_JsonResult",
        e[e.SpeechServiceConnection_Url = 29] = "SpeechServiceConnection_Url",
        e[e.SpeechServiceConnection_InitialSilenceTimeoutMs = 30] = "SpeechServiceConnection_InitialSilenceTimeoutMs",
        e[e.SpeechServiceConnection_EndSilenceTimeoutMs = 31] = "SpeechServiceConnection_EndSilenceTimeoutMs",
        e[e.SpeechServiceConnection_EnableAudioLogging = 32] = "SpeechServiceConnection_EnableAudioLogging",
        e[e.SpeechServiceResponse_ProfanityOption = 33] = "SpeechServiceResponse_ProfanityOption",
        e[e.SpeechServiceResponse_PostProcessingOption = 34] = "SpeechServiceResponse_PostProcessingOption",
        e[e.SpeechServiceResponse_RequestWordLevelTimestamps = 35] = "SpeechServiceResponse_RequestWordLevelTimestamps",
        e[e.SpeechServiceResponse_StablePartialResultThreshold = 36] = "SpeechServiceResponse_StablePartialResultThreshold",
        e[e.SpeechServiceResponse_OutputFormatOption = 37] = "SpeechServiceResponse_OutputFormatOption",
        e[e.SpeechServiceResponse_TranslationRequestStablePartialResult = 38] = "SpeechServiceResponse_TranslationRequestStablePartialResult",
        e[e.Conversation_ApplicationId = 39] = "Conversation_ApplicationId",
        e[e.Conversation_DialogType = 40] = "Conversation_DialogType",
        e[e.Conversation_Initial_Silence_Timeout = 41] = "Conversation_Initial_Silence_Timeout",
        e[e.Conversation_From_Id = 42] = "Conversation_From_Id",
        e[e.Conversation_Conversation_Id = 43] = "Conversation_Conversation_Id",
        e[e.Conversation_Custom_Voice_Deployment_Ids = 44] = "Conversation_Custom_Voice_Deployment_Ids",
        e[e.Conversation_Speech_Activity_Template = 45] = "Conversation_Speech_Activity_Template",
        e[e.Conversation_Request_Bot_Status_Messages = 46] = "Conversation_Request_Bot_Status_Messages",
        e[e.Conversation_Agent_Connection_Id = 47] = "Conversation_Agent_Connection_Id",
        e[e.SpeechServiceConnection_Host = 48] = "SpeechServiceConnection_Host",
        e[e.ConversationTranslator_Host = 49] = "ConversationTranslator_Host",
        e[e.ConversationTranslator_Name = 50] = "ConversationTranslator_Name",
        e[e.ConversationTranslator_CorrelationId = 51] = "ConversationTranslator_CorrelationId",
        e[e.ConversationTranslator_Token = 52] = "ConversationTranslator_Token",
        e[e.PronunciationAssessment_ReferenceText = 53] = "PronunciationAssessment_ReferenceText",
        e[e.PronunciationAssessment_GradingSystem = 54] = "PronunciationAssessment_GradingSystem",
        e[e.PronunciationAssessment_Granularity = 55] = "PronunciationAssessment_Granularity",
        e[e.PronunciationAssessment_EnableMiscue = 56] = "PronunciationAssessment_EnableMiscue",
        e[e.PronunciationAssessment_Json = 57] = "PronunciationAssessment_Json",
        e[e.PronunciationAssessment_Params = 58] = "PronunciationAssessment_Params",
        e[e.SpeakerRecognition_Api_Version = 59] = "SpeakerRecognition_Api_Version"
    }(t.PropertyId || (t.PropertyId = {}))
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
      , i = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.Recognizer = void 0;
    var o = r(53)
      , s = r(4)
      , a = r(63)
      , c = r(61)
      , u = function() {
        function e(e, t, r) {
            this.audioConfig = void 0 !== e ? e : c.AudioConfig.fromDefaultMicrophoneInput(),
            this.privDisposed = !1,
            this.privProperties = t.clone(),
            this.privConnectionFactory = r,
            this.implCommonRecognizerSetup()
        }
        return e.prototype.close = function(e, t) {
            a.Contracts.throwIfDisposed(this.privDisposed),
            s.marshalPromiseToCallbacks(this.dispose(!0), e, t)
        }
        ,
        Object.defineProperty(e.prototype, "internalData", {
            get: function() {
                return this.privReco
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.dispose = function(e) {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return this.privDisposed ? [2] : (this.privDisposed = !0,
                        e && this.privReco ? [4, this.privReco.audioSource.turnOff()] : [3, 3]);
                    case 1:
                        return t.sent(),
                        [4, this.privReco.dispose()];
                    case 2:
                        t.sent(),
                        t.label = 3;
                    case 3:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        Object.defineProperty(e, "telemetryEnabled", {
            get: function() {
                return o.ServiceRecognizerBase.telemetryDataEnabled
            },
            enumerable: !1,
            configurable: !0
        }),
        e.enableTelemetry = function(e) {
            o.ServiceRecognizerBase.telemetryDataEnabled = e
        }
        ,
        e.prototype.implCommonRecognizerSetup = function() {
            var t = "undefined" != typeof window ? "Browser" : "Node"
              , r = "unknown"
              , n = "unknown";
            "undefined" != typeof navigator && (t = t + "/" + navigator.platform,
            r = navigator.userAgent,
            n = navigator.appVersion);
            var i = this.createRecognizerConfig(new o.SpeechServiceConfig(new o.Context(new o.OS(t,r,n))));
            this.privReco = this.createServiceRecognizer(e.getAuthFromProperties(this.privProperties), this.privConnectionFactory, this.audioConfig, i)
        }
        ,
        e.prototype.recognizeOnceAsyncImpl = function(e) {
            return n(this, void 0, void 0, (function() {
                var t, r;
                return i(this, (function(n) {
                    switch (n.label) {
                    case 0:
                        return a.Contracts.throwIfDisposed(this.privDisposed),
                        t = new s.Deferred,
                        [4, this.implRecognizerStop()];
                    case 1:
                        return n.sent(),
                        [4, this.privReco.recognize(e, t.resolve, t.reject)];
                    case 2:
                        return n.sent(),
                        [4, t.promise];
                    case 3:
                        return r = n.sent(),
                        [4, this.implRecognizerStop()];
                    case 4:
                        return n.sent(),
                        [2, r]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.startContinuousRecognitionAsyncImpl = function(e) {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return a.Contracts.throwIfDisposed(this.privDisposed),
                        [4, this.implRecognizerStop()];
                    case 1:
                        return t.sent(),
                        [4, this.privReco.recognize(e, void 0, void 0)];
                    case 2:
                        return t.sent(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.stopContinuousRecognitionAsyncImpl = function() {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(e) {
                    switch (e.label) {
                    case 0:
                        return a.Contracts.throwIfDisposed(this.privDisposed),
                        [4, this.implRecognizerStop()];
                    case 1:
                        return e.sent(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.implRecognizerStop = function() {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(e) {
                    switch (e.label) {
                    case 0:
                        return this.privReco ? [4, this.privReco.stopRecognizing()] : [3, 2];
                    case 1:
                        e.sent(),
                        e.label = 2;
                    case 2:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.getAuthFromProperties = function(e) {
            var t = e.getProperty(c.PropertyId.SpeechServiceConnection_Key, void 0);
            return t && "" !== t ? new o.CognitiveSubscriptionKeyAuthentication(t) : new o.CognitiveTokenAuthentication((function(t) {
                var r = e.getProperty(c.PropertyId.SpeechServiceAuthorization_Token, void 0);
                return Promise.resolve(r)
            }
            ),(function(t) {
                var r = e.getProperty(c.PropertyId.SpeechServiceAuthorization_Token, void 0);
                return Promise.resolve(r)
            }
            ))
        }
        ,
        e
    }();
    t.Recognizer = u
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    ), o = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
    , s = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeechRecognizer = void 0;
    var a = r(53)
      , c = r(4)
      , u = r(63)
      , p = r(61)
      , l = function(e) {
        function t(t, r) {
            var n = this
              , i = t;
            return u.Contracts.throwIfNull(i, "speechConfig"),
            u.Contracts.throwIfNullOrWhitespace(i.properties.getProperty(p.PropertyId.SpeechServiceConnection_RecoLanguage), p.PropertyId[p.PropertyId.SpeechServiceConnection_RecoLanguage]),
            (n = e.call(this, r, i.properties, new a.SpeechConnectionFactory) || this).privDisposedRecognizer = !1,
            n
        }
        return i(t, e),
        t.FromConfig = function(e, r, n) {
            var i = e;
            return r.properties.mergeTo(i.properties),
            new t(e,n)
        }
        ,
        Object.defineProperty(t.prototype, "endpointId", {
            get: function() {
                return u.Contracts.throwIfDisposed(this.privDisposedRecognizer),
                this.properties.getProperty(p.PropertyId.SpeechServiceConnection_EndpointId, "00000000-0000-0000-0000-000000000000")
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "authorizationToken", {
            get: function() {
                return this.properties.getProperty(p.PropertyId.SpeechServiceAuthorization_Token)
            },
            set: function(e) {
                u.Contracts.throwIfNullOrWhitespace(e, "token"),
                this.properties.setProperty(p.PropertyId.SpeechServiceAuthorization_Token, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "speechRecognitionLanguage", {
            get: function() {
                return u.Contracts.throwIfDisposed(this.privDisposedRecognizer),
                this.properties.getProperty(p.PropertyId.SpeechServiceConnection_RecoLanguage)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "outputFormat", {
            get: function() {
                return u.Contracts.throwIfDisposed(this.privDisposedRecognizer),
                this.properties.getProperty(a.OutputFormatPropertyName, p.OutputFormat[p.OutputFormat.Simple]) === p.OutputFormat[p.OutputFormat.Simple] ? p.OutputFormat.Simple : p.OutputFormat.Detailed
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.recognizeOnceAsync = function(e, t) {
            c.marshalPromiseToCallbacks(this.recognizeOnceAsyncImpl(a.RecognitionMode.Interactive), e, t)
        }
        ,
        t.prototype.startContinuousRecognitionAsync = function(e, t) {
            c.marshalPromiseToCallbacks(this.startContinuousRecognitionAsyncImpl(a.RecognitionMode.Conversation), e, t)
        }
        ,
        t.prototype.stopContinuousRecognitionAsync = function(e, t) {
            c.marshalPromiseToCallbacks(this.stopContinuousRecognitionAsyncImpl(), e, t)
        }
        ,
        t.prototype.startKeywordRecognitionAsync = function(e, t, r) {
            u.Contracts.throwIfNull(e, "model"),
            r && r("Not yet implemented.")
        }
        ,
        t.prototype.stopKeywordRecognitionAsync = function(e, t) {
            e && e()
        }
        ,
        t.prototype.close = function(e, t) {
            u.Contracts.throwIfDisposed(this.privDisposedRecognizer),
            c.marshalPromiseToCallbacks(this.dispose(!0), e, t)
        }
        ,
        t.prototype.dispose = function(t) {
            return o(this, void 0, void 0, (function() {
                return s(this, (function(r) {
                    switch (r.label) {
                    case 0:
                        return this.privDisposedRecognizer ? [2] : t ? (this.privDisposedRecognizer = !0,
                        [4, this.implRecognizerStop()]) : [3, 2];
                    case 1:
                        r.sent(),
                        r.label = 2;
                    case 2:
                        return [4, e.prototype.dispose.call(this, t)];
                    case 3:
                        return r.sent(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.createRecognizerConfig = function(e) {
            return new a.RecognizerConfig(e,this.properties)
        }
        ,
        t.prototype.createServiceRecognizer = function(e, t, r, n) {
            var i = r;
            return new a.SpeechServiceRecognizer(e,t,i,n,this)
        }
        ,
        t
    }(p.Recognizer);
    t.SpeechRecognizer = l
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    ), o = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
    , s = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.IntentRecognizer = void 0;
    var a = r(53)
      , c = r(4)
      , u = r(63)
      , p = r(61)
      , l = function(e) {
        function t(t, r) {
            var n = this;
            u.Contracts.throwIfNullOrUndefined(t, "speechConfig");
            var i = t;
            return u.Contracts.throwIfNullOrUndefined(i, "speechConfig"),
            (n = e.call(this, r, i.properties, new a.IntentConnectionFactory) || this).privAddedIntents = [],
            n.privAddedLmIntents = {},
            n.privDisposedIntentRecognizer = !1,
            n.privProperties = i.properties,
            u.Contracts.throwIfNullOrWhitespace(n.properties.getProperty(p.PropertyId.SpeechServiceConnection_RecoLanguage), p.PropertyId[p.PropertyId.SpeechServiceConnection_RecoLanguage]),
            n
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "speechRecognitionLanguage", {
            get: function() {
                return u.Contracts.throwIfDisposed(this.privDisposedIntentRecognizer),
                this.properties.getProperty(p.PropertyId.SpeechServiceConnection_RecoLanguage)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "authorizationToken", {
            get: function() {
                return this.properties.getProperty(p.PropertyId.SpeechServiceAuthorization_Token)
            },
            set: function(e) {
                this.properties.setProperty(p.PropertyId.SpeechServiceAuthorization_Token, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.recognizeOnceAsync = function(e, t) {
            if (u.Contracts.throwIfDisposed(this.privDisposedIntentRecognizer),
            0 !== Object.keys(this.privAddedLmIntents).length || void 0 !== this.privUmbrellaIntent) {
                var r = this.buildSpeechContext();
                this.privReco.speechContext.setSection("intent", r.Intent),
                this.privReco.dynamicGrammar.addReferenceGrammar(r.ReferenceGrammars),
                this.privReco.setIntents(this.privAddedLmIntents, this.privUmbrellaIntent)
            }
            c.marshalPromiseToCallbacks(this.recognizeOnceAsyncImpl(a.RecognitionMode.Interactive), e, t)
        }
        ,
        t.prototype.startContinuousRecognitionAsync = function(e, t) {
            if (0 !== Object.keys(this.privAddedLmIntents).length || void 0 !== this.privUmbrellaIntent) {
                var r = this.buildSpeechContext();
                this.privReco.speechContext.setSection("intent", r.Intent),
                this.privReco.dynamicGrammar.addReferenceGrammar(r.ReferenceGrammars),
                this.privReco.setIntents(this.privAddedLmIntents, this.privUmbrellaIntent)
            }
            c.marshalPromiseToCallbacks(this.startContinuousRecognitionAsyncImpl(a.RecognitionMode.Conversation), e, t)
        }
        ,
        t.prototype.stopContinuousRecognitionAsync = function(e, t) {
            c.marshalPromiseToCallbacks(this.stopContinuousRecognitionAsyncImpl(), e, t)
        }
        ,
        t.prototype.startKeywordRecognitionAsync = function(e, t, r) {
            u.Contracts.throwIfNull(e, "model"),
            r && r("Not yet implemented.")
        }
        ,
        t.prototype.stopKeywordRecognitionAsync = function(e, t) {
            e && e()
        }
        ,
        t.prototype.addIntent = function(e, t) {
            u.Contracts.throwIfDisposed(this.privDisposedIntentRecognizer),
            u.Contracts.throwIfNullOrWhitespace(t, "intentId"),
            u.Contracts.throwIfNullOrWhitespace(e, "simplePhrase"),
            this.privAddedIntents.push([t, e])
        }
        ,
        t.prototype.addIntentWithLanguageModel = function(e, t, r) {
            u.Contracts.throwIfDisposed(this.privDisposedIntentRecognizer),
            u.Contracts.throwIfNullOrWhitespace(e, "intentId"),
            u.Contracts.throwIfNull(t, "model");
            var n = t;
            u.Contracts.throwIfNullOrWhitespace(n.appId, "model.appId"),
            this.privAddedLmIntents[e] = new a.AddedLmIntent(n,r)
        }
        ,
        t.prototype.addAllIntents = function(e, t) {
            u.Contracts.throwIfNull(e, "model");
            var r = e;
            u.Contracts.throwIfNullOrWhitespace(r.appId, "model.appId"),
            this.privUmbrellaIntent = new a.AddedLmIntent(r,t)
        }
        ,
        t.prototype.close = function(e, t) {
            u.Contracts.throwIfDisposed(this.privDisposedIntentRecognizer),
            c.marshalPromiseToCallbacks(this.dispose(!0), e, t)
        }
        ,
        t.prototype.createRecognizerConfig = function(e) {
            return new a.RecognizerConfig(e,this.properties)
        }
        ,
        t.prototype.createServiceRecognizer = function(e, t, r, n) {
            var i = r;
            return new a.IntentServiceRecognizer(e,t,i,n,this)
        }
        ,
        t.prototype.dispose = function(t) {
            return o(this, void 0, void 0, (function() {
                return s(this, (function(r) {
                    switch (r.label) {
                    case 0:
                        return this.privDisposedIntentRecognizer ? [2] : t ? (this.privDisposedIntentRecognizer = !0,
                        [4, e.prototype.dispose.call(this, t)]) : [3, 2];
                    case 1:
                        r.sent(),
                        r.label = 2;
                    case 2:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.buildSpeechContext = function() {
            var e, t, r, n = [];
            void 0 !== this.privUmbrellaIntent && (e = this.privUmbrellaIntent.modelImpl.appId,
            t = this.privUmbrellaIntent.modelImpl.region,
            r = this.privUmbrellaIntent.modelImpl.subscriptionKey);
            for (var i = 0, o = Object.keys(this.privAddedLmIntents); i < o.length; i++) {
                var s = o[i]
                  , a = this.privAddedLmIntents[s];
                if (void 0 === e)
                    e = a.modelImpl.appId;
                else if (e !== a.modelImpl.appId)
                    throw new Error("Intents must all be from the same LUIS model");
                if (void 0 === t)
                    t = a.modelImpl.region;
                else if (t !== a.modelImpl.region)
                    throw new Error("Intents must all be from the same LUIS model in a single region");
                if (void 0 === r)
                    r = a.modelImpl.subscriptionKey;
                else if (r !== a.modelImpl.subscriptionKey)
                    throw new Error("Intents must all use the same subscription key");
                var c = "luis/" + e + "-PRODUCTION#" + s;
                n.push(c)
            }
            return {
                Intent: {
                    id: e,
                    key: void 0 === r ? this.privProperties.getProperty(p.PropertyId[p.PropertyId.SpeechServiceConnection_Key]) : r,
                    provider: "LUIS"
                },
                ReferenceGrammars: void 0 === this.privUmbrellaIntent ? n : ["luis/" + e + "-PRODUCTION"]
            }
        }
        ,
        t
    }(p.Recognizer);
    t.IntentRecognizer = l
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.VoiceProfileType = void 0,
    function(e) {
        e[e.TextIndependentIdentification = 0] = "TextIndependentIdentification",
        e[e.TextDependentVerification = 1] = "TextDependentVerification",
        e[e.TextIndependentVerification = 2] = "TextIndependentVerification"
    }(t.VoiceProfileType || (t.VoiceProfileType = {}))
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    ), o = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
    , s = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.TranslationRecognizer = void 0;
    var a = r(53)
      , c = r(4)
      , u = r(105)
      , p = r(63)
      , l = r(61)
      , f = function(e) {
        function t(t, r) {
            var n = this
              , i = t;
            return p.Contracts.throwIfNull(i, "speechConfig"),
            (n = e.call(this, r, i.properties, new a.TranslationConnectionFactory) || this).privDisposedTranslationRecognizer = !1,
            void 0 !== n.properties.getProperty(l.PropertyId.SpeechServiceConnection_TranslationVoice, void 0) && p.Contracts.throwIfNullOrWhitespace(n.properties.getProperty(l.PropertyId.SpeechServiceConnection_TranslationVoice), l.PropertyId[l.PropertyId.SpeechServiceConnection_TranslationVoice]),
            p.Contracts.throwIfNullOrWhitespace(n.properties.getProperty(l.PropertyId.SpeechServiceConnection_TranslationToLanguages), l.PropertyId[l.PropertyId.SpeechServiceConnection_TranslationToLanguages]),
            p.Contracts.throwIfNullOrWhitespace(n.properties.getProperty(l.PropertyId.SpeechServiceConnection_RecoLanguage), l.PropertyId[l.PropertyId.SpeechServiceConnection_RecoLanguage]),
            n
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "speechRecognitionLanguage", {
            get: function() {
                return p.Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer),
                this.properties.getProperty(l.PropertyId.SpeechServiceConnection_RecoLanguage)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "targetLanguages", {
            get: function() {
                return p.Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer),
                this.properties.getProperty(l.PropertyId.SpeechServiceConnection_TranslationToLanguages).split(",")
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "voiceName", {
            get: function() {
                return p.Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer),
                this.properties.getProperty(l.PropertyId.SpeechServiceConnection_TranslationVoice, void 0)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "authorizationToken", {
            get: function() {
                return this.properties.getProperty(l.PropertyId.SpeechServiceAuthorization_Token)
            },
            set: function(e) {
                this.properties.setProperty(l.PropertyId.SpeechServiceAuthorization_Token, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.recognizeOnceAsync = function(e, t) {
            p.Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer),
            c.marshalPromiseToCallbacks(this.recognizeOnceAsyncImpl(a.RecognitionMode.Conversation), e, t)
        }
        ,
        t.prototype.startContinuousRecognitionAsync = function(e, t) {
            c.marshalPromiseToCallbacks(this.startContinuousRecognitionAsyncImpl(a.RecognitionMode.Conversation), e, t)
        }
        ,
        t.prototype.stopContinuousRecognitionAsync = function(e, t) {
            c.marshalPromiseToCallbacks(this.stopContinuousRecognitionAsyncImpl(), e, t)
        }
        ,
        t.prototype.removeTargetLanguage = function(e) {
            if (p.Contracts.throwIfNullOrUndefined(e, "language to be removed"),
            void 0 !== this.properties.getProperty(l.PropertyId.SpeechServiceConnection_TranslationToLanguages, void 0)) {
                var t = this.properties.getProperty(l.PropertyId.SpeechServiceConnection_TranslationToLanguages).split(",")
                  , r = t.indexOf(e);
                r > -1 && (t.splice(r, 1),
                this.properties.setProperty(l.PropertyId.SpeechServiceConnection_TranslationToLanguages, t.join(",")),
                this.updateLanguages(t))
            }
        }
        ,
        t.prototype.addTargetLanguage = function(e) {
            p.Contracts.throwIfNullOrUndefined(e, "language to be added");
            var t = [];
            void 0 !== this.properties.getProperty(l.PropertyId.SpeechServiceConnection_TranslationToLanguages, void 0) ? (t = this.properties.getProperty(l.PropertyId.SpeechServiceConnection_TranslationToLanguages).split(",")).includes(e) || (t.push(e),
            this.properties.setProperty(l.PropertyId.SpeechServiceConnection_TranslationToLanguages, t.join(","))) : (this.properties.setProperty(l.PropertyId.SpeechServiceConnection_TranslationToLanguages, e),
            t = [e]),
            this.updateLanguages(t)
        }
        ,
        t.prototype.close = function(e, t) {
            p.Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer),
            c.marshalPromiseToCallbacks(this.dispose(!0), e, t)
        }
        ,
        t.prototype.onConnection = function() {}
        ,
        t.prototype.onDisconnection = function() {
            return o(this, void 0, void 0, (function() {
                return s(this, (function(e) {
                    return [2]
                }
                ))
            }
            ))
        }
        ,
        t.prototype.dispose = function(t) {
            return o(this, void 0, void 0, (function() {
                return s(this, (function(r) {
                    switch (r.label) {
                    case 0:
                        return this.privDisposedTranslationRecognizer ? [2] : (this.privDisposedTranslationRecognizer = !0,
                        t ? [4, this.implRecognizerStop()] : [3, 3]);
                    case 1:
                        return r.sent(),
                        [4, e.prototype.dispose.call(this, t)];
                    case 2:
                        r.sent(),
                        r.label = 3;
                    case 3:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.createRecognizerConfig = function(e) {
            return new a.RecognizerConfig(e,this.properties)
        }
        ,
        t.prototype.createServiceRecognizer = function(e, t, r, n) {
            var i = r;
            return new a.TranslationServiceRecognizer(e,t,i,n,this)
        }
        ,
        t.prototype.updateLanguages = function(e) {
            var t = u.Connection.fromRecognizer(this);
            t && (t.setMessageProperty("speech.context", "translationcontext", {
                to: e
            }),
            t.sendMessageAsync("event", JSON.stringify({
                id: "translation",
                name: "updateLanguage",
                to: e
            })))
        }
        ,
        t
    }(l.Recognizer);
    t.TranslationRecognizer = f
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.Connection = void 0;
    var n = r(53)
      , i = r(4)
      , o = r(106)
      , s = r(63)
      , a = r(61)
      , c = function() {
        function e() {}
        return e.fromRecognizer = function(t) {
            var r = t.internalData
              , n = new e;
            return n.privInternalData = r,
            n.setupEvents(),
            n
        }
        ,
        e.fromSynthesizer = function(t) {
            var r = t.internalData
              , n = new e;
            return n.privInternalData = r,
            n.setupEvents(),
            n
        }
        ,
        e.prototype.openConnection = function(e, t) {
            i.marshalPromiseToCallbacks(this.privInternalData.connect(), e, t)
        }
        ,
        e.prototype.closeConnection = function(e, t) {
            if (this.privInternalData instanceof n.SynthesisAdapterBase)
                throw new Error("Disconnecting a synthesizer's connection is currently not supported");
            i.marshalPromiseToCallbacks(this.privInternalData.disconnect(), e, t)
        }
        ,
        e.prototype.setMessageProperty = function(e, t, r) {
            if (s.Contracts.throwIfNullOrWhitespace(t, "propertyName"),
            this.privInternalData instanceof n.ServiceRecognizerBase) {
                if ("speech.context" !== e.toLowerCase())
                    throw new Error("Only speech.context message property sets are currently supported for recognizer");
                this.privInternalData.speechContext.setSection(t, r)
            } else if (this.privInternalData instanceof n.SynthesisAdapterBase) {
                if ("synthesis.context" !== e.toLowerCase())
                    throw new Error("Only synthesis.context message property sets are currently supported for synthesizer");
                this.privInternalData.synthesisContext.setSection(t, r)
            }
        }
        ,
        e.prototype.sendMessageAsync = function(e, t, r, n) {
            i.marshalPromiseToCallbacks(this.privInternalData.sendNetworkMessage(e, t), r, n)
        }
        ,
        e.prototype.close = function() {}
        ,
        e.prototype.setupEvents = function() {
            var e = this;
            this.privEventListener = this.privInternalData.connectionEvents.attach((function(t) {
                "ConnectionEstablishedEvent" === t.name ? e.connected && e.connected(new a.ConnectionEventArgs(t.connectionId)) : "ConnectionClosedEvent" === t.name ? e.disconnected && e.disconnected(new a.ConnectionEventArgs(t.connectionId)) : "ConnectionMessageSentEvent" === t.name ? e.messageSent && e.messageSent(new a.ConnectionMessageEventArgs(new o.ConnectionMessageImpl(t.message))) : "ConnectionMessageReceivedEvent" === t.name && e.messageReceived && e.messageReceived(new a.ConnectionMessageEventArgs(new o.ConnectionMessageImpl(t.message)))
            }
            )),
            this.privServiceEventListener = this.privInternalData.serviceEvents.attach((function(t) {
                e.receivedServiceMessage && e.receivedServiceMessage(new a.ServiceEventArgs(t.jsonString,t.name))
            }
            ))
        }
        ,
        e
    }();
    t.Connection = c
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConnectionMessageImpl = t.ConnectionMessage = void 0;
    var n = r(55)
      , i = r(4)
      , o = r(98)
      , s = r(99)
      , a = function() {};
    t.ConnectionMessage = a;
    var c = function() {
        function e(e) {
            var t = this;
            this.privConnectionMessage = e,
            this.privProperties = new o.PropertyCollection,
            this.privConnectionMessage.headers[n.HeaderNames.ConnectionId] && this.privProperties.setProperty(s.PropertyId.Speech_SessionId, this.privConnectionMessage.headers[n.HeaderNames.ConnectionId]),
            Object.keys(this.privConnectionMessage.headers).forEach((function(e, r, n) {
                t.privProperties.setProperty(e, t.privConnectionMessage.headers[e])
            }
            ))
        }
        return Object.defineProperty(e.prototype, "path", {
            get: function() {
                return this.privConnectionMessage.headers[Object.keys(this.privConnectionMessage.headers).find((function(e) {
                    return e.toLowerCase() === "path".toLowerCase()
                }
                ))]
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "isTextMessage", {
            get: function() {
                return this.privConnectionMessage.messageType === i.MessageType.Text
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "isBinaryMessage", {
            get: function() {
                return this.privConnectionMessage.messageType === i.MessageType.Binary
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "TextMessage", {
            get: function() {
                return this.privConnectionMessage.textBody
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "binaryMessage", {
            get: function() {
                return this.privConnectionMessage.binaryBody
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.toString = function() {
            return ""
        }
        ,
        e
    }();
    t.ConnectionMessageImpl = c
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.Translations = void 0;
    var n = r(61)
      , i = function() {
        function e() {
            this.privMap = new n.PropertyCollection
        }
        return e.prototype.get = function(e, t) {
            return this.privMap.getProperty(e, t)
        }
        ,
        e.prototype.set = function(e, t) {
            this.privMap.setProperty(e, t)
        }
        ,
        Object.defineProperty(e.prototype, "languages", {
            get: function() {
                return this.privMap.keys
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.Translations = i
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.NoMatchReason = void 0,
    function(e) {
        e[e.NotRecognized = 0] = "NotRecognized",
        e[e.InitialSilenceTimeout = 1] = "InitialSilenceTimeout",
        e[e.InitialBabbleTimeout = 2] = "InitialBabbleTimeout"
    }(t.NoMatchReason || (t.NoMatchReason = {}))
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.NoMatchDetails = void 0;
    var n = r(53)
      , i = r(61)
      , o = function() {
        function e(e) {
            this.privReason = e
        }
        return e.fromResult = function(t) {
            var r = n.SimpleSpeechPhrase.fromJSON(t.json)
              , o = i.NoMatchReason.NotRecognized;
            switch (r.RecognitionStatus) {
            case n.RecognitionStatus.BabbleTimeout:
                o = i.NoMatchReason.InitialBabbleTimeout;
                break;
            case n.RecognitionStatus.InitialSilenceTimeout:
                o = i.NoMatchReason.InitialSilenceTimeout;
                break;
            default:
                o = i.NoMatchReason.NotRecognized
            }
            return new e(o)
        }
        ,
        Object.defineProperty(e.prototype, "reason", {
            get: function() {
                return this.privReason
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.NoMatchDetails = o
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.TranslationRecognitionCanceledEventArgs = void 0;
    var n = function() {
        function e(e, t, r, n, i) {
            this.privCancelReason = t,
            this.privErrorDetails = r,
            this.privResult = i,
            this.privSessionId = e,
            this.privErrorCode = n
        }
        return Object.defineProperty(e.prototype, "result", {
            get: function() {
                return this.privResult
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "sessionId", {
            get: function() {
                return this.privSessionId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "reason", {
            get: function() {
                return this.privCancelReason
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "errorCode", {
            get: function() {
                return this.privErrorCode
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "errorDetails", {
            get: function() {
                return this.privErrorDetails
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.TranslationRecognitionCanceledEventArgs = n
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.IntentRecognitionCanceledEventArgs = void 0;
    var o = function(e) {
        function t(t, r, n, i, o, s) {
            var a = e.call(this, i, o, s) || this;
            return a.privReason = t,
            a.privErrorDetails = r,
            a.privErrorCode = n,
            a
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "reason", {
            get: function() {
                return this.privReason
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "errorCode", {
            get: function() {
                return this.privErrorCode
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "errorDetails", {
            get: function() {
                return this.privErrorDetails
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(r(61).IntentRecognitionEventArgs);
    t.IntentRecognitionCanceledEventArgs = o
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.CancellationDetailsBase = void 0;
    var n = function() {
        function e(e, t, r) {
            this.privReason = e,
            this.privErrorDetails = t,
            this.privErrorCode = r
        }
        return Object.defineProperty(e.prototype, "reason", {
            get: function() {
                return this.privReason
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "errorDetails", {
            get: function() {
                return this.privErrorDetails
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "ErrorCode", {
            get: function() {
                return this.privErrorCode
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.CancellationDetailsBase = n
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.CancellationDetails = void 0;
    var o = r(53)
      , s = r(112)
      , a = r(61)
      , c = function(e) {
        function t(t, r, n) {
            return e.call(this, t, r, n) || this
        }
        return i(t, e),
        t.fromResult = function(e) {
            var r = a.CancellationReason.Error
              , n = a.CancellationErrorCode.NoError;
            if (e instanceof a.RecognitionResult && e.json) {
                var i = o.SimpleSpeechPhrase.fromJSON(e.json);
                r = o.EnumTranslation.implTranslateCancelResult(i.RecognitionStatus)
            }
            return e.properties && (n = a.CancellationErrorCode[e.properties.getProperty(o.CancellationErrorCodePropertyName, a.CancellationErrorCode[a.CancellationErrorCode.NoError])]),
            new t(r,e.errorDetails || o.EnumTranslation.implTranslateErrorDetails(n),n)
        }
        ,
        t
    }(s.CancellationDetailsBase);
    t.CancellationDetails = c
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.CancellationErrorCode = void 0,
    function(e) {
        e[e.NoError = 0] = "NoError",
        e[e.AuthenticationFailure = 1] = "AuthenticationFailure",
        e[e.BadRequestParameters = 2] = "BadRequestParameters",
        e[e.TooManyRequests = 3] = "TooManyRequests",
        e[e.ConnectionFailure = 4] = "ConnectionFailure",
        e[e.ServiceTimeout = 5] = "ServiceTimeout",
        e[e.ServiceError = 6] = "ServiceError",
        e[e.RuntimeError = 7] = "RuntimeError",
        e[e.Forbidden = 8] = "Forbidden"
    }(t.CancellationErrorCode || (t.CancellationErrorCode = {}))
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConnectionEventArgs = void 0;
    var o = function(e) {
        function t() {
            return null !== e && e.apply(this, arguments) || this
        }
        return i(t, e),
        t
    }(r(61).SessionEventArgs);
    t.ConnectionEventArgs = o
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ServiceEventArgs = void 0;
    var o = function(e) {
        function t(t, r, n) {
            var i = e.call(this, n) || this;
            return i.privJsonResult = t,
            i.privEventName = r,
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "jsonString", {
            get: function() {
                return this.privJsonResult
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "eventName", {
            get: function() {
                return this.privEventName
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(r(61).SessionEventArgs);
    t.ServiceEventArgs = o
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.PhraseListGrammar = void 0;
    var n = function() {
        function e(e) {
            this.privGrammerBuilder = e.dynamicGrammar
        }
        return e.fromRecognizer = function(t) {
            return new e(t.internalData)
        }
        ,
        e.prototype.addPhrase = function(e) {
            this.privGrammerBuilder.addPhrase(e)
        }
        ,
        e.prototype.addPhrases = function(e) {
            this.privGrammerBuilder.addPhrase(e)
        }
        ,
        e.prototype.clear = function() {
            this.privGrammerBuilder.clearPhrases()
        }
        ,
        e
    }();
    t.PhraseListGrammar = n
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.DialogServiceConfigImpl = t.DialogServiceConfig = void 0;
    var o = r(63)
      , s = r(61)
      , a = function() {
        function e() {}
        var t;
        return Object.defineProperty(e.prototype, "applicationId", {
            set: function(e) {},
            enumerable: !1,
            configurable: !0
        }),
        e.DialogTypes = ((t = function() {}
        ).BotFramework = "bot_framework",
        t.CustomCommands = "custom_commands",
        t),
        e
    }();
    t.DialogServiceConfig = a;
    var c = function(e) {
        function t() {
            var t = e.call(this) || this;
            return t.privSpeechConfig = new s.SpeechConfigImpl,
            t
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "properties", {
            get: function() {
                return this.privSpeechConfig.properties
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "speechRecognitionLanguage", {
            get: function() {
                return this.privSpeechConfig.speechRecognitionLanguage
            },
            set: function(e) {
                o.Contracts.throwIfNullOrWhitespace(e, "value"),
                this.privSpeechConfig.speechRecognitionLanguage = e
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "outputFormat", {
            get: function() {
                return this.privSpeechConfig.outputFormat
            },
            set: function(e) {
                this.privSpeechConfig.outputFormat = e
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.setProperty = function(e, t) {
            this.privSpeechConfig.setProperty(e, t)
        }
        ,
        t.prototype.getProperty = function(e, t) {
            return this.privSpeechConfig.getProperty(e)
        }
        ,
        t.prototype.setProxy = function(e, t, r, n) {
            this.setProperty(s.PropertyId.SpeechServiceConnection_ProxyHostName, e),
            this.setProperty(s.PropertyId.SpeechServiceConnection_ProxyPort, "" + t),
            r && this.setProperty(s.PropertyId.SpeechServiceConnection_ProxyUserName, r),
            n && this.setProperty(s.PropertyId.SpeechServiceConnection_ProxyPassword, n)
        }
        ,
        t.prototype.setServiceProperty = function(e, t, r) {
            this.privSpeechConfig.setServiceProperty(e, t, r)
        }
        ,
        t.prototype.close = function() {}
        ,
        t
    }(a);
    t.DialogServiceConfigImpl = c
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.BotFrameworkConfig = void 0;
    var o = r(63)
      , s = r(118)
      , a = r(61)
      , c = function(e) {
        function t() {
            return e.call(this) || this
        }
        return i(t, e),
        t.fromSubscription = function(e, t, r) {
            o.Contracts.throwIfNullOrWhitespace(e, "subscription"),
            o.Contracts.throwIfNullOrWhitespace(t, "region");
            var n = new s.DialogServiceConfigImpl;
            return n.setProperty(a.PropertyId.Conversation_DialogType, s.DialogServiceConfig.DialogTypes.BotFramework),
            n.setProperty(a.PropertyId.SpeechServiceConnection_Key, e),
            n.setProperty(a.PropertyId.SpeechServiceConnection_Region, t),
            r && n.setProperty(a.PropertyId.Conversation_ApplicationId, r),
            n
        }
        ,
        t.fromAuthorizationToken = function(e, t, r) {
            o.Contracts.throwIfNullOrWhitespace(e, "authorizationToken"),
            o.Contracts.throwIfNullOrWhitespace(t, "region");
            var n = new s.DialogServiceConfigImpl;
            return n.setProperty(a.PropertyId.Conversation_DialogType, s.DialogServiceConfig.DialogTypes.BotFramework),
            n.setProperty(a.PropertyId.SpeechServiceAuthorization_Token, e),
            n.setProperty(a.PropertyId.SpeechServiceConnection_Region, t),
            r && n.setProperty(a.PropertyId.Conversation_ApplicationId, r),
            n
        }
        ,
        t.fromHost = function(e, t, r) {
            o.Contracts.throwIfNullOrUndefined(e, "host");
            var n = e instanceof URL ? e : new URL("wss://" + e + ".convai.speech.azure.us");
            o.Contracts.throwIfNullOrUndefined(n, "resolvedHost");
            var i = new s.DialogServiceConfigImpl;
            return i.setProperty(a.PropertyId.Conversation_DialogType, s.DialogServiceConfig.DialogTypes.BotFramework),
            i.setProperty(a.PropertyId.SpeechServiceConnection_Host, n.toString()),
            void 0 !== t && i.setProperty(a.PropertyId.SpeechServiceConnection_Key, t),
            i
        }
        ,
        t.fromEndpoint = function(e, t) {
            o.Contracts.throwIfNull(e, "endpoint");
            var r = new s.DialogServiceConfigImpl;
            return r.setProperty(a.PropertyId.Conversation_DialogType, s.DialogServiceConfig.DialogTypes.BotFramework),
            r.setProperty(a.PropertyId.SpeechServiceConnection_Endpoint, e.toString()),
            void 0 !== t && r.setProperty(a.PropertyId.SpeechServiceConnection_Key, t),
            r
        }
        ,
        t
    }(s.DialogServiceConfigImpl);
    t.BotFrameworkConfig = c
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.CustomCommandsConfig = void 0;
    var o = r(63)
      , s = r(118)
      , a = r(61)
      , c = function(e) {
        function t() {
            return e.call(this) || this
        }
        return i(t, e),
        t.fromSubscription = function(e, t, r) {
            o.Contracts.throwIfNullOrWhitespace(e, "applicationId"),
            o.Contracts.throwIfNullOrWhitespace(t, "subscription"),
            o.Contracts.throwIfNullOrWhitespace(r, "region");
            var n = new s.DialogServiceConfigImpl;
            return n.setProperty(a.PropertyId.Conversation_DialogType, s.DialogServiceConfig.DialogTypes.CustomCommands),
            n.setProperty(a.PropertyId.Conversation_ApplicationId, e),
            n.setProperty(a.PropertyId.SpeechServiceConnection_Key, t),
            n.setProperty(a.PropertyId.SpeechServiceConnection_Region, r),
            n
        }
        ,
        t.fromAuthorizationToken = function(e, t, r) {
            o.Contracts.throwIfNullOrWhitespace(e, "applicationId"),
            o.Contracts.throwIfNullOrWhitespace(t, "authorizationToken"),
            o.Contracts.throwIfNullOrWhitespace(r, "region");
            var n = new s.DialogServiceConfigImpl;
            return n.setProperty(a.PropertyId.Conversation_DialogType, s.DialogServiceConfig.DialogTypes.CustomCommands),
            n.setProperty(a.PropertyId.Conversation_ApplicationId, e),
            n.setProperty(a.PropertyId.SpeechServiceAuthorization_Token, t),
            n.setProperty(a.PropertyId.SpeechServiceConnection_Region, r),
            n
        }
        ,
        Object.defineProperty(t.prototype, "applicationId", {
            get: function() {
                return this.getProperty(a.PropertyId.Conversation_ApplicationId)
            },
            set: function(e) {
                o.Contracts.throwIfNullOrWhitespace(e, "value"),
                this.setProperty(a.PropertyId.Conversation_ApplicationId, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(s.DialogServiceConfigImpl);
    t.CustomCommandsConfig = c
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    ), o = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
    , s = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.DialogServiceConnector = void 0;
    var a = r(122)
      , c = r(53)
      , u = r(4)
      , p = r(63)
      , l = r(61)
      , f = r(99)
      , h = function(e) {
        function t(t, r) {
            var n = this
              , i = t;
            p.Contracts.throwIfNull(t, "dialogConfig"),
            (n = e.call(this, r, i.properties, new a.DialogConnectionFactory) || this).isTurnComplete = !0,
            n.privIsDisposed = !1,
            n.privProperties = i.properties.clone();
            var o = n.buildAgentConfig();
            return n.privReco.agentConfig.set(o),
            n
        }
        return i(t, e),
        t.prototype.connect = function(e, t) {
            u.marshalPromiseToCallbacks(this.privReco.connect(), e, t)
        }
        ,
        t.prototype.disconnect = function(e, t) {
            u.marshalPromiseToCallbacks(this.privReco.disconnect(), e, t)
        }
        ,
        Object.defineProperty(t.prototype, "authorizationToken", {
            get: function() {
                return this.properties.getProperty(f.PropertyId.SpeechServiceAuthorization_Token)
            },
            set: function(e) {
                p.Contracts.throwIfNullOrWhitespace(e, "token"),
                this.properties.setProperty(f.PropertyId.SpeechServiceAuthorization_Token, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "speechActivityTemplate", {
            get: function() {
                return this.properties.getProperty(f.PropertyId.Conversation_Speech_Activity_Template)
            },
            set: function(e) {
                this.properties.setProperty(f.PropertyId.Conversation_Speech_Activity_Template, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.listenOnceAsync = function(e, t) {
            var r = this;
            if (this.isTurnComplete) {
                p.Contracts.throwIfDisposed(this.privIsDisposed);
                var n = o(r, void 0, void 0, (function() {
                    var e, t;
                    return s(this, (function(r) {
                        switch (r.label) {
                        case 0:
                            return [4, this.privReco.connect()];
                        case 1:
                            return r.sent(),
                            [4, this.implRecognizerStop()];
                        case 2:
                            return r.sent(),
                            this.isTurnComplete = !1,
                            e = new u.Deferred,
                            [4, this.privReco.recognize(c.RecognitionMode.Conversation, e.resolve, e.reject)];
                        case 3:
                            return r.sent(),
                            [4, e.promise];
                        case 4:
                            return t = r.sent(),
                            [4, this.implRecognizerStop()];
                        case 5:
                            return r.sent(),
                            [2, t]
                        }
                    }
                    ))
                }
                ));
                n.catch((function() {
                    r.dispose(!0).catch((function() {}
                    ))
                }
                )),
                u.marshalPromiseToCallbacks(n.finally((function() {
                    r.isTurnComplete = !0
                }
                )), e, t)
            }
        }
        ,
        t.prototype.sendActivityAsync = function(e, t, r) {
            u.marshalPromiseToCallbacks(this.privReco.sendMessage(e), t, r)
        }
        ,
        t.prototype.close = function(e, t) {
            p.Contracts.throwIfDisposed(this.privIsDisposed),
            u.marshalPromiseToCallbacks(this.dispose(!0), e, t)
        }
        ,
        t.prototype.dispose = function(t) {
            return o(this, void 0, void 0, (function() {
                return s(this, (function(r) {
                    switch (r.label) {
                    case 0:
                        return this.privIsDisposed ? [2] : t ? (this.privIsDisposed = !0,
                        [4, this.implRecognizerStop()]) : [3, 3];
                    case 1:
                        return r.sent(),
                        [4, e.prototype.dispose.call(this, t)];
                    case 2:
                        r.sent(),
                        r.label = 3;
                    case 3:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.createRecognizerConfig = function(e) {
            return new c.RecognizerConfig(e,this.privProperties)
        }
        ,
        t.prototype.createServiceRecognizer = function(e, t, r, n) {
            var i = r;
            return new c.DialogServiceAdapter(e,t,i,n,this)
        }
        ,
        t.prototype.buildAgentConfig = function() {
            return {
                botInfo: {
                    commType: this.properties.getProperty("Conversation_Communication_Type", "Default"),
                    commandsCulture: void 0,
                    connectionId: this.properties.getProperty(f.PropertyId.Conversation_Agent_Connection_Id),
                    conversationId: this.properties.getProperty(f.PropertyId.Conversation_Conversation_Id, void 0),
                    fromId: this.properties.getProperty(f.PropertyId.Conversation_From_Id, void 0),
                    ttsAudioFormat: this.properties.getProperty(f.PropertyId.SpeechServiceConnection_SynthOutputFormat, void 0)
                },
                version: .2
            }
        }
        ,
        t
    }(l.Recognizer);
    t.DialogServiceConnector = h
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.DialogConnectionFactory = void 0;
    var o = r(2)
      , s = r(53)
      , a = r(61)
      , c = r(123)
      , u = r(53)
      , p = r(55)
      , l = r(124)
      , f = function(e) {
        function t() {
            var r = null !== e && e.apply(this, arguments) || this;
            return r.create = function(e, n, i) {
                var f = e.parameters.getProperty(a.PropertyId.Conversation_ApplicationId, "")
                  , h = e.parameters.getProperty(a.PropertyId.Conversation_DialogType)
                  , v = e.parameters.getProperty(a.PropertyId.SpeechServiceConnection_Region)
                  , d = e.parameters.getProperty(a.PropertyId.SpeechServiceConnection_RecoLanguage, "en-US")
                  , y = e.parameters.getProperty(a.PropertyId.Conversation_Request_Bot_Status_Messages, "true")
                  , g = {};
                g[p.HeaderNames.ConnectionId] = i,
                g[l.QueryParameterNames.Format] = e.parameters.getProperty(s.OutputFormatPropertyName, a.OutputFormat[a.OutputFormat.Simple]).toLowerCase(),
                g[l.QueryParameterNames.Language] = d,
                g[l.QueryParameterNames.RequestBotStatusMessages] = y,
                f && (g[l.QueryParameterNames.BotId] = f,
                h === a.DialogServiceConfig.DialogTypes.CustomCommands && (g[p.HeaderNames.CustomCommandsAppId] = f));
                var m = h === a.DialogServiceConfig.DialogTypes.CustomCommands ? "commands/" : ""
                  , b = h === a.DialogServiceConfig.DialogTypes.CustomCommands ? "v1" : h === a.DialogServiceConfig.DialogTypes.BotFramework ? "v3" : "v0"
                  , S = {};
                null != n.token && "" !== n.token && (S[n.headerName] = n.token);
                var C = e.parameters.getProperty(a.PropertyId.SpeechServiceConnection_Endpoint, "");
                if (!C) {
                    var P = c.ConnectionFactoryBase.getHostSuffix(v)
                      , w = e.parameters.getProperty(a.PropertyId.SpeechServiceConnection_Host, "wss://" + v + "." + t.Constants.BaseUrl + P);
                    C = "" + (w.endsWith("/") ? w : w + "/") + m + t.Constants.ApiKey + "/" + b
                }
                r.setCommonUrlParams(e, g, C);
                var R = "true" === e.parameters.getProperty("SPEECH-EnableWebsocketCompression", "false");
                return new o.WebsocketConnection(C,g,S,new u.WebsocketMessageFormatter,o.ProxyInfo.fromRecognizerConfig(e),R,i)
            }
            ,
            r
        }
        var r;
        return i(t, e),
        t.Constants = ((r = function() {}
        ).ApiKey = "api",
        r.BaseUrl = "convai.speech",
        r),
        t
    }(c.ConnectionFactoryBase);
    t.DialogConnectionFactory = f
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConnectionFactoryBase = void 0;
    var n = r(53)
      , i = r(61)
      , o = r(124)
      , s = function() {
        function e() {}
        return e.getHostSuffix = function(e) {
            if (e) {
                if (e.toLowerCase().startsWith("china"))
                    return ".azure.cn";
                if (e.toLowerCase().startsWith("usgov"))
                    return ".azure.us"
            }
            return ".microsoft.com"
        }
        ,
        e.prototype.setCommonUrlParams = function(e, t, r) {
            this.setUrlParameter(i.PropertyId.SpeechServiceConnection_EnableAudioLogging, o.QueryParameterNames.EnableAudioLogging, e, t, r),
            this.setUrlParameter(i.PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, o.QueryParameterNames.EnableWordLevelTimestamps, e, t, r),
            this.setUrlParameter(i.PropertyId.SpeechServiceResponse_ProfanityOption, o.QueryParameterNames.Profanity, e, t, r),
            this.setUrlParameter(i.PropertyId.SpeechServiceConnection_InitialSilenceTimeoutMs, o.QueryParameterNames.InitialSilenceTimeoutMs, e, t, r),
            this.setUrlParameter(i.PropertyId.SpeechServiceConnection_EndSilenceTimeoutMs, o.QueryParameterNames.EndSilenceTimeoutMs, e, t, r),
            this.setUrlParameter(i.PropertyId.SpeechServiceResponse_StablePartialResultThreshold, o.QueryParameterNames.StableIntermediateThreshold, e, t, r);
            var s = JSON.parse(e.parameters.getProperty(n.ServicePropertiesPropertyName, "{}"));
            Object.keys(s).forEach((function(e, r, n) {
                t[e] = s[e]
            }
            ))
        }
        ,
        e.prototype.setUrlParameter = function(e, t, r, n, i) {
            var o = r.parameters.getProperty(e, void 0);
            !o || i && -1 !== i.search(t) || (n[t] = o.toLocaleLowerCase())
        }
        ,
        e
    }();
    t.ConnectionFactoryBase = s
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.QueryParameterNames = void 0;
    var n = function() {
        function e() {}
        return e.BotId = "botid",
        e.CustomSpeechDeploymentId = "cid",
        e.CustomVoiceDeploymentId = "deploymentId",
        e.EnableAudioLogging = "storeAudio",
        e.EnableLanguageId = "lidEnabled",
        e.EnableWordLevelTimestamps = "wordLevelTimestamps",
        e.EndSilenceTimeoutMs = "endSilenceTimeoutMs",
        e.Format = "format",
        e.InitialSilenceTimeoutMs = "initialSilenceTimeoutMs",
        e.Language = "language",
        e.Profanity = "profanity",
        e.RequestBotStatusMessages = "enableBotMessageStatus",
        e.StableIntermediateThreshold = "stableIntermediateThreshold",
        e.StableTranslation = "stableTranslation",
        e.TestHooks = "testhooks",
        e
    }();
    t.QueryParameterNames = n
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ActivityReceivedEventArgs = void 0;
    var n = function() {
        function e(e, t) {
            this.privActivity = e,
            this.privAudioStream = t
        }
        return Object.defineProperty(e.prototype, "activity", {
            get: function() {
                return this.privActivity
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "audioStream", {
            get: function() {
                return this.privAudioStream
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.ActivityReceivedEventArgs = n
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.TurnStatusReceivedEventArgs = void 0;
    var n = r(127)
      , i = function() {
        function e(e) {
            this.privTurnStatus = n.TurnStatusResponsePayload.fromJSON(e)
        }
        return Object.defineProperty(e.prototype, "interactionId", {
            get: function() {
                return this.privTurnStatus.interactionId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "conversationId", {
            get: function() {
                return this.privTurnStatus.conversationId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "statusCode", {
            get: function() {
                return this.privTurnStatus.statusCode
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.TurnStatusReceivedEventArgs = i
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.TurnStatusResponsePayload = void 0;
    var n = function() {
        function e(e) {
            this.privMessageStatusResponse = JSON.parse(e)
        }
        return e.fromJSON = function(t) {
            return new e(t)
        }
        ,
        Object.defineProperty(e.prototype, "interactionId", {
            get: function() {
                return this.privMessageStatusResponse.interactionId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "conversationId", {
            get: function() {
                return this.privMessageStatusResponse.conversationId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "statusCode", {
            get: function() {
                switch (this.privMessageStatusResponse.statusCode) {
                case "Success":
                    return 200;
                case "Failed":
                    return 400;
                case "TimedOut":
                    return 429;
                default:
                    return this.privMessageStatusResponse.statusCode
                }
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.TurnStatusResponsePayload = n
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ServicePropertyChannel = void 0,
    function(e) {
        e[e.UriQueryParameter = 0] = "UriQueryParameter"
    }(t.ServicePropertyChannel || (t.ServicePropertyChannel = {}))
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ProfanityOption = void 0,
    function(e) {
        e[e.Masked = 0] = "Masked",
        e[e.Removed = 1] = "Removed",
        e[e.Raw = 2] = "Raw"
    }(t.ProfanityOption || (t.ProfanityOption = {}))
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
      , i = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.BaseAudioPlayer = void 0;
    var o = r(25)
      , s = r(40)
      , a = r(61)
      , c = r(72)
      , u = function() {
        function e(e) {
            this.audioContext = null,
            this.gainNode = null,
            this.autoUpdateBufferTimer = 0,
            void 0 === e && (e = a.AudioStreamFormat.getDefaultInputFormat()),
            this.init(e)
        }
        return e.prototype.playAudioSample = function(e, t, r) {
            var o = this;
            s.marshalPromiseToCallbacks(n(o, void 0, void 0, (function() {
                var t, r;
                return i(this, (function(n) {
                    return this.ensureInitializedContext(),
                    t = this.formatAudioData(e),
                    (r = new Float32Array(this.samples.length + t.length)).set(this.samples, 0),
                    r.set(t, this.samples.length),
                    this.samples = r,
                    [2]
                }
                ))
            }
            )), t, r)
        }
        ,
        e.prototype.stopAudio = function(e, t) {
            null !== this.audioContext && (this.samples = new Float32Array,
            clearInterval(this.autoUpdateBufferTimer),
            this.audioContext.close().then((function() {
                e && e()
            }
            ), (function(e) {
                t && t(e)
            }
            )),
            this.audioContext = null)
        }
        ,
        e.prototype.init = function(e) {
            this.audioFormat = e,
            this.samples = new Float32Array
        }
        ,
        e.prototype.ensureInitializedContext = function() {
            var e = this;
            if (null === this.audioContext) {
                this.createAudioContext();
                this.autoUpdateBufferTimer = setInterval((function() {
                    e.updateAudioBuffer()
                }
                ), 200)
            }
        }
        ,
        e.prototype.createAudioContext = function() {
            this.audioContext = c.AudioStreamFormatImpl.getAudioContext(),
            this.gainNode = this.audioContext.createGain(),
            this.gainNode.gain.value = 1,
            this.gainNode.connect(this.audioContext.destination),
            this.startTime = this.audioContext.currentTime
        }
        ,
        e.prototype.formatAudioData = function(e) {
            switch (this.audioFormat.bitsPerSample) {
            case 8:
                return this.formatArrayBuffer(new Int8Array(e), 128);
            case 16:
                return this.formatArrayBuffer(new Int16Array(e), 32768);
            case 32:
                return this.formatArrayBuffer(new Int32Array(e), 2147483648);
            default:
                throw new o.InvalidOperationError("Only WAVE_FORMAT_PCM (8/16/32 bps) format supported at this time")
            }
        }
        ,
        e.prototype.formatArrayBuffer = function(e, t) {
            for (var r = new Float32Array(e.length), n = 0; n < e.length; n++)
                r[n] = e[n] / t;
            return r
        }
        ,
        e.prototype.updateAudioBuffer = function() {
            if (0 !== this.samples.length) {
                for (var e = this.audioFormat.channels, t = this.audioContext.createBufferSource(), r = this.samples.length / e, n = this.audioContext.createBuffer(e, r, this.audioFormat.samplesPerSec), i = 0; i < e; i++)
                    for (var o = i, s = n.getChannelData(i), a = 0; a < this.samples.length; a++,
                    o += e)
                        s[a] = this.samples[o];
                this.startTime < this.audioContext.currentTime && (this.startTime = this.audioContext.currentTime),
                t.buffer = n,
                t.connect(this.gainNode),
                t.start(this.startTime),
                this.startTime += n.duration,
                this.samples = new Float32Array
            }
        }
        ,
        e.prototype.playAudio = function(e) {
            return n(this, void 0, void 0, (function() {
                var t, r;
                return i(this, (function(n) {
                    switch (n.label) {
                    case 0:
                        return null === this.audioContext && this.createAudioContext(),
                        t = this.audioContext.createBufferSource(),
                        r = this.audioContext.destination,
                        [4, this.audioContext.decodeAudioData(e, (function(e) {
                            t.buffer = e,
                            t.connect(r),
                            t.start(0)
                        }
                        ))];
                    case 1:
                        return n.sent(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e
    }();
    t.BaseAudioPlayer = u
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConnectionMessageEventArgs = void 0;
    var n = function() {
        function e(e) {
            this.privConnectionMessage = e
        }
        return Object.defineProperty(e.prototype, "message", {
            get: function() {
                return this.privConnectionMessage
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.toString = function() {
            return "Message: " + this.privConnectionMessage.toString()
        }
        ,
        e
    }();
    t.ConnectionMessageEventArgs = n
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.VoiceProfile = void 0;
    var n = function() {
        function e(e, t) {
            this.privId = e,
            this.privProfileType = t
        }
        return Object.defineProperty(e.prototype, "profileId", {
            get: function() {
                return this.privId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "profileType", {
            get: function() {
                return this.privProfileType
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.VoiceProfile = n
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.VoiceProfileEnrollmentCancellationDetails = t.VoiceProfileEnrollmentResult = void 0;
    var o = r(53)
      , s = r(61)
      , a = function() {
        function e(e, t, r) {
            this.privReason = e,
            this.privProperties = new s.PropertyCollection,
            this.privReason !== s.ResultReason.Canceled ? t && (this.privDetails = JSON.parse(t),
            "enrolling" === this.privDetails.enrollmentStatus.toLowerCase() && (this.privReason = s.ResultReason.EnrollingVoiceProfile)) : (this.privErrorDetails = r,
            this.privProperties.setProperty(o.CancellationErrorCodePropertyName, s.CancellationErrorCode[s.CancellationErrorCode.ServiceError]))
        }
        return e.FromIdentificationProfileList = function(t) {
            for (var r = [], n = 0, i = t.value; n < i.length; n++) {
                var o = i[n]
                  , a = new e("enrolling" === o.enrollmentStatus.toLowerCase() ? s.ResultReason.EnrollingVoiceProfile : "enrolled" === o.enrollmentStatus.toLowerCase() ? s.ResultReason.EnrolledVoiceProfile : s.ResultReason.Canceled,null,null);
                a.privDetails = this.getIdentificationDetails(o),
                r.push(a)
            }
            return r
        }
        ,
        e.FromVerificationProfileList = function(t) {
            for (var r = [], n = 0, i = t.value; n < i.length; n++) {
                var o = i[n]
                  , a = new e("enrolling" === o.enrollmentStatus.toLowerCase() ? s.ResultReason.EnrollingVoiceProfile : "enrolled" === o.enrollmentStatus.toLowerCase() ? s.ResultReason.EnrolledVoiceProfile : s.ResultReason.Canceled,null,null);
                a.privDetails = this.getVerificationDetails(o),
                r.push(a)
            }
            return r
        }
        ,
        Object.defineProperty(e.prototype, "reason", {
            get: function() {
                return this.privReason
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "enrollmentsCount", {
            get: function() {
                return this.privDetails.enrollmentsCount
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "enrollmentsLengthInSec", {
            get: function() {
                return this.privDetails.enrollmentsLengthInSec
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "enrollmentResultDetails", {
            get: function() {
                return this.privDetails
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "errorDetails", {
            get: function() {
                return this.privErrorDetails
            },
            enumerable: !1,
            configurable: !0
        }),
        e.getIdentificationDetails = function(e) {
            return {
                audioLengthInSec: e.audioLengthInSec ? parseFloat(e.audioLengthInSec) : 0,
                audioSpeechLengthInSec: e.audioSpeechLengthInSec ? parseFloat(e.audioSpeechLengthInSec) : 0,
                enrollmentStatus: e.enrollmentStatus,
                enrollmentsCount: e.enrollmentsCount || 0,
                enrollmentsLengthInSec: e.enrollmentsLengthInSec ? parseFloat(e.enrollmentsLengthInSec) : 0,
                enrollmentsSpeechLengthInSec: e.enrollmentsSpeechLengthInSec ? parseFloat(e.enrollmentsSpeechLengthInSec) : 0,
                profileId: e.profileId || e.identificationProfileId,
                remainingEnrollmentsSpeechLengthInSec: e.remainingEnrollmentsSpeechLengthInSec ? parseFloat(e.remainingEnrollmentsSpeechLengthInSec) : 0
            }
        }
        ,
        e.getVerificationDetails = function(e) {
            return {
                audioLengthInSec: e.audioLengthInSec ? parseFloat(e.audioLengthInSec) : 0,
                audioSpeechLengthInSec: e.audioSpeechLengthInSec ? parseFloat(e.audioSpeechLengthInSec) : 0,
                enrollmentStatus: e.enrollmentStatus,
                enrollmentsCount: e.enrollmentsCount,
                enrollmentsLengthInSec: e.enrollmentsLengthInSec ? parseFloat(e.enrollmentsLengthInSec) : 0,
                enrollmentsSpeechLengthInSec: e.enrollmentsSpeechLengthInSec ? parseFloat(e.enrollmentsSpeechLengthInSec) : 0,
                profileId: e.profileId || e.verificationProfileId,
                remainingEnrollmentsCount: e.remainingEnrollments || e.remainingEnrollmentsCount,
                remainingEnrollmentsSpeechLengthInSec: e.remainingEnrollmentsSpeechLengthInSec ? parseFloat(e.remainingEnrollmentsSpeechLengthInSec) : 0
            }
        }
        ,
        e
    }();
    t.VoiceProfileEnrollmentResult = a;
    var c = function(e) {
        function t(t, r, n) {
            return e.call(this, t, r, n) || this
        }
        return i(t, e),
        t.fromResult = function(e) {
            var r = s.CancellationReason.Error
              , n = s.CancellationErrorCode.NoError;
            return e.properties && (n = s.CancellationErrorCode[e.properties.getProperty(o.CancellationErrorCodePropertyName, s.CancellationErrorCode[s.CancellationErrorCode.NoError])]),
            new t(r,e.errorDetails,n)
        }
        ,
        t
    }(s.CancellationDetailsBase);
    t.VoiceProfileEnrollmentCancellationDetails = c
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.VoiceProfileCancellationDetails = t.VoiceProfileResult = void 0;
    var o = r(53)
      , s = r(63)
      , a = r(61)
      , c = function() {
        function e(e, t) {
            this.privReason = e,
            this.privProperties = new a.PropertyCollection,
            e === a.ResultReason.Canceled && (s.Contracts.throwIfNullOrUndefined(t, "statusText"),
            this.privErrorDetails = t,
            this.privProperties.setProperty(o.CancellationErrorCodePropertyName, a.CancellationErrorCode[a.CancellationErrorCode.ServiceError]))
        }
        return Object.defineProperty(e.prototype, "reason", {
            get: function() {
                return this.privReason
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "errorDetails", {
            get: function() {
                return this.privErrorDetails
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.VoiceProfileResult = c;
    var u = function(e) {
        function t(t, r, n) {
            return e.call(this, t, r, n) || this
        }
        return i(t, e),
        t.fromResult = function(e) {
            var r = a.CancellationReason.Error
              , n = a.CancellationErrorCode.NoError;
            return e.properties && (n = a.CancellationErrorCode[e.properties.getProperty(o.CancellationErrorCodePropertyName, a.CancellationErrorCode[a.CancellationErrorCode.NoError])]),
            new t(r,e.errorDetails,n)
        }
        ,
        t
    }(a.CancellationDetailsBase);
    t.VoiceProfileCancellationDetails = u
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.VoiceProfilePhraseResult = void 0;
    var o = r(63)
      , s = function(e) {
        function t(t, r, n) {
            var i = e.call(this, t, r) || this;
            if (i.privPhrases = [],
            o.Contracts.throwIfNullOrUndefined(n, "phrase result JSON"),
            n.value && n.value[0])
                for (var s = 0, a = n.value; s < a.length; s++) {
                    var c = a[s];
                    i.privPhrases.push(c.passPhrase || c.activationPhrase)
                }
            return i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "phrases", {
            get: function() {
                return this.privPhrases
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(r(61).VoiceProfileResult);
    t.VoiceProfilePhraseResult = s
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
      , i = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.VoiceProfileClient = void 0;
    var o = r(53)
      , s = r(63)
      , a = r(61)
      , c = function() {
        function e(e) {
            var t = e;
            s.Contracts.throwIfNull(t, "speechConfig"),
            this.privProperties = t.properties.clone(),
            this.implClientSetup()
        }
        return Object.defineProperty(e.prototype, "authorizationToken", {
            get: function() {
                return this.properties.getProperty(a.PropertyId.SpeechServiceAuthorization_Token)
            },
            set: function(e) {
                s.Contracts.throwIfNullOrWhitespace(e, "token"),
                this.properties.setProperty(a.PropertyId.SpeechServiceAuthorization_Token, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.createProfileAsync = function(e, t) {
            return n(this, void 0, void 0, (function() {
                var r, n;
                return i(this, (function(i) {
                    switch (i.label) {
                    case 0:
                        return [4, this.privAdapter.createProfile(e, t)];
                    case 1:
                        if (!(r = i.sent()).ok)
                            throw new Error("createProfileAsync failed with code: " + r.status + ", message: " + r.statusText);
                        return n = r.json,
                        [2, new a.VoiceProfile(n.profileId,e)]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.retrieveEnrollmentResultAsync = function(e) {
            return n(this, void 0, void 0, (function() {
                var t;
                return i(this, (function(r) {
                    switch (r.label) {
                    case 0:
                        return [4, this.privAdapter.getProfileStatus(e)];
                    case 1:
                        return t = r.sent(),
                        [2, new a.VoiceProfileEnrollmentResult(t.ok ? a.ResultReason.EnrolledVoiceProfile : a.ResultReason.Canceled,t.data,t.statusText)]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.getAllProfilesAsync = function(e) {
            return n(this, void 0, void 0, (function() {
                var t;
                return i(this, (function(r) {
                    switch (r.label) {
                    case 0:
                        return [4, this.privAdapter.getProfiles(e)];
                    case 1:
                        return t = r.sent(),
                        e === a.VoiceProfileType.TextIndependentIdentification ? [2, a.VoiceProfileEnrollmentResult.FromIdentificationProfileList(t.json)] : [2, a.VoiceProfileEnrollmentResult.FromVerificationProfileList(t.json)]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.getActivationPhrasesAsync = function(e, t) {
            return n(this, void 0, void 0, (function() {
                var r;
                return i(this, (function(n) {
                    switch (n.label) {
                    case 0:
                        return [4, this.privAdapter.getPhrases(e, t)];
                    case 1:
                        return r = n.sent(),
                        [2, new a.VoiceProfilePhraseResult(r.ok ? a.ResultReason.EnrollingVoiceProfile : a.ResultReason.Canceled,r.statusText,r.json)]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.enrollProfileAsync = function(e, t) {
            return n(this, void 0, void 0, (function() {
                var r, n;
                return i(this, (function(i) {
                    switch (i.label) {
                    case 0:
                        return r = t,
                        s.Contracts.throwIfNullOrUndefined(r, "audioConfig"),
                        [4, this.privAdapter.createEnrollment(e, r)];
                    case 1:
                        return n = i.sent(),
                        [2, new a.VoiceProfileEnrollmentResult(n.ok ? a.ResultReason.EnrolledVoiceProfile : a.ResultReason.Canceled,n.data,n.statusText)]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.deleteProfileAsync = function(e) {
            return n(this, void 0, void 0, (function() {
                var t;
                return i(this, (function(r) {
                    switch (r.label) {
                    case 0:
                        return [4, this.privAdapter.deleteProfile(e)];
                    case 1:
                        return t = r.sent(),
                        [2, this.getResult(t, a.ResultReason.DeletedVoiceProfile)]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.resetProfileAsync = function(e) {
            return n(this, void 0, void 0, (function() {
                var t;
                return i(this, (function(r) {
                    switch (r.label) {
                    case 0:
                        return [4, this.privAdapter.resetProfile(e)];
                    case 1:
                        return t = r.sent(),
                        [2, this.getResult(t, a.ResultReason.ResetVoiceProfile)]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.close = function() {}
        ,
        e.prototype.implClientSetup = function() {
            var e = "undefined" != typeof window ? "Browser" : "Node"
              , t = "unknown"
              , r = "unknown";
            "undefined" != typeof navigator && (e = e + "/" + navigator.platform,
            t = navigator.userAgent,
            r = navigator.appVersion);
            var n = new o.SpeakerRecognitionConfig(new o.Context(new o.OS(e,t,r)),this.privProperties);
            this.privAdapter = new o.SpeakerIdMessageAdapter(n)
        }
        ,
        e.prototype.getResult = function(e, t, r) {
            return new a.VoiceProfileResult(e.ok ? t : a.ResultReason.Canceled,e.statusText)
        }
        ,
        e
    }();
    t.VoiceProfileClient = c
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
      , i = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeakerRecognizer = void 0;
    var o = r(53)
      , s = r(63)
      , a = r(61)
      , c = function() {
        function e(e, t) {
            var r = e;
            s.Contracts.throwIfNull(r, "speechConfig"),
            this.privAudioConfigImpl = t,
            s.Contracts.throwIfNull(this.privAudioConfigImpl, "audioConfig"),
            this.privProperties = r.properties.clone(),
            this.implSRSetup()
        }
        return Object.defineProperty(e.prototype, "authorizationToken", {
            get: function() {
                return this.properties.getProperty(a.PropertyId.SpeechServiceAuthorization_Token)
            },
            set: function(e) {
                s.Contracts.throwIfNullOrWhitespace(e, "token"),
                this.properties.setProperty(a.PropertyId.SpeechServiceAuthorization_Token, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.recognizeOnceAsync = function(e) {
            return n(this, void 0, void 0, (function() {
                var t;
                return i(this, (function(r) {
                    if (e instanceof a.SpeakerIdentificationModel)
                        return t = this.privAdapter.identifySpeaker(e, this.privAudioConfigImpl),
                        [2, this.getResult(t, a.SpeakerRecognitionResultType.Identify, void 0)];
                    if (e instanceof a.SpeakerVerificationModel)
                        return t = this.privAdapter.verifySpeaker(e, this.privAudioConfigImpl),
                        [2, this.getResult(t, a.SpeakerRecognitionResultType.Verify, e.voiceProfile.profileId)];
                    throw new Error("SpeakerRecognizer.recognizeOnce: Unexpected model type")
                }
                ))
            }
            ))
        }
        ,
        e.prototype.close = function() {}
        ,
        e.prototype.implSRSetup = function() {
            var e = "undefined" != typeof window ? "Browser" : "Node"
              , t = "unknown"
              , r = "unknown";
            "undefined" != typeof navigator && (e = e + "/" + navigator.platform,
            t = navigator.userAgent,
            r = navigator.appVersion);
            var n = new o.SpeakerRecognitionConfig(new o.Context(new o.OS(e,t,r)),this.privProperties);
            this.privAdapter = new o.SpeakerIdMessageAdapter(n)
        }
        ,
        e.prototype.getResult = function(e, t, r) {
            return n(this, void 0, void 0, (function() {
                var n;
                return i(this, (function(i) {
                    switch (i.label) {
                    case 0:
                        return [4, e];
                    case 1:
                        return n = i.sent(),
                        [2, new a.SpeakerRecognitionResult(t,n.data,r,n.ok ? a.ResultReason.RecognizedSpeaker : a.ResultReason.Canceled)]
                    }
                }
                ))
            }
            ))
        }
        ,
        e
    }();
    t.SpeakerRecognizer = c
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeakerIdentificationModel = void 0;
    var n = r(63)
      , i = r(61)
      , o = function() {
        function e(e) {
            var t = this;
            if (this.privVoiceProfiles = [],
            n.Contracts.throwIfNullOrUndefined(e, "VoiceProfiles"),
            0 === e.length)
                throw new Error("Empty Voice Profiles array");
            e.forEach((function(e) {
                if (e.profileType !== i.VoiceProfileType.TextIndependentIdentification)
                    throw new Error("Identification model can only be created from Identification profile: " + e.profileId);
                t.privVoiceProfiles.push(e)
            }
            ))
        }
        return e.fromProfiles = function(t) {
            return new e(t)
        }
        ,
        Object.defineProperty(e.prototype, "voiceProfileIds", {
            get: function() {
                return this.privVoiceProfiles.map((function(e) {
                    return e.profileId
                }
                )).join(",")
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.SpeakerIdentificationModel = o
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeakerVerificationModel = void 0;
    var n = r(63)
      , i = r(61)
      , o = function() {
        function e(e) {
            if (n.Contracts.throwIfNullOrUndefined(e, "VoiceProfile"),
            e.profileType === i.VoiceProfileType.TextIndependentIdentification)
                throw new Error("Verification model cannot be created from Identification profile");
            this.privVoiceProfile = e
        }
        return e.fromProfile = function(t) {
            return new e(t)
        }
        ,
        Object.defineProperty(e.prototype, "voiceProfile", {
            get: function() {
                return this.privVoiceProfile
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.SpeakerVerificationModel = o
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.AutoDetectSourceLanguageConfig = void 0;
    var n = r(53)
      , i = r(63)
      , o = r(61)
      , s = function() {
        function e() {
            this.privProperties = new o.PropertyCollection
        }
        return e.fromOpenRange = function() {
            var t = new e;
            return t.properties.setProperty(o.PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, n.AutoDetectSourceLanguagesOpenRangeOptionName),
            t
        }
        ,
        e.fromLanguages = function(t) {
            i.Contracts.throwIfArrayEmptyOrWhitespace(t, "languages");
            var r = new e;
            return r.properties.setProperty(o.PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, t.join()),
            r
        }
        ,
        e.fromSourceLanguageConfigs = function(t) {
            if (t.length < 1)
                throw new Error("Expected non-empty SourceLanguageConfig array.");
            var r = new e
              , n = [];
            return t.forEach((function(e) {
                if (n.push(e.language),
                void 0 !== e.endpointId && "" !== e.endpointId) {
                    var t = e.language + o.PropertyId.SpeechServiceConnection_EndpointId.toString();
                    r.properties.setProperty(t, e.endpointId)
                }
            }
            )),
            r.properties.setProperty(o.PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, n.join()),
            r
        }
        ,
        Object.defineProperty(e.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.AutoDetectSourceLanguageConfig = s
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.AutoDetectSourceLanguageResult = void 0;
    var n = r(63)
      , i = function() {
        function e(e, t) {
            n.Contracts.throwIfNullOrUndefined(e, "language"),
            n.Contracts.throwIfNullOrUndefined(t, "languageDetectionConfidence"),
            this.privLanguage = e,
            this.privLanguageDetectionConfidence = t
        }
        return e.fromResult = function(t) {
            return new e(t.language,t.languageDetectionConfidence)
        }
        ,
        Object.defineProperty(e.prototype, "language", {
            get: function() {
                return this.privLanguage
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "languageDetectionConfidence", {
            get: function() {
                return this.privLanguageDetectionConfidence
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.AutoDetectSourceLanguageResult = i
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SourceLanguageConfig = void 0;
    var n = r(63)
      , i = function() {
        function e(e, t) {
            n.Contracts.throwIfNullOrUndefined(e, "language"),
            this.privLanguage = e,
            this.privEndpointId = t
        }
        return e.fromLanguage = function(t, r) {
            return new e(t,r)
        }
        ,
        Object.defineProperty(e.prototype, "language", {
            get: function() {
                return this.privLanguage
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "endpointId", {
            get: function() {
                return this.privEndpointId
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.SourceLanguageConfig = i
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeakerRecognitionCancellationDetails = t.SpeakerRecognitionResult = t.SpeakerRecognitionResultType = void 0;
    var o, s = r(53), a = r(63), c = r(61);
    !function(e) {
        e[e.Verify = 0] = "Verify",
        e[e.Identify = 1] = "Identify"
    }(o = t.SpeakerRecognitionResultType || (t.SpeakerRecognitionResultType = {}));
    var u = function() {
        function e(e, t, r, n) {
            if (void 0 === n && (n = c.ResultReason.RecognizedSpeaker),
            this.privProperties = new c.PropertyCollection,
            this.privReason = n,
            this.privReason !== c.ResultReason.Canceled)
                if (e === o.Identify) {
                    var i = JSON.parse(t);
                    a.Contracts.throwIfNullOrUndefined(i, "JSON"),
                    this.privProfileId = i.identifiedProfile.profileId,
                    this.privScore = i.identifiedProfile.score
                } else {
                    i = JSON.parse(t);
                    a.Contracts.throwIfNullOrUndefined(i, "JSON"),
                    this.privScore = i.score,
                    "accept" !== i.recognitionResult.toLowerCase() && (this.privReason = c.ResultReason.NoMatch),
                    void 0 !== r && "" !== r && (this.privProfileId = r)
                }
            else {
                i = JSON.parse(t);
                a.Contracts.throwIfNullOrUndefined(i, "JSON"),
                this.privErrorDetails = i.statusText,
                this.privProperties.setProperty(s.CancellationErrorCodePropertyName, c.CancellationErrorCode[c.CancellationErrorCode.ServiceError])
            }
            this.privProperties.setProperty(c.PropertyId.SpeechServiceResponse_JsonResult, t)
        }
        return Object.defineProperty(e.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "reason", {
            get: function() {
                return this.privReason
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "profileId", {
            get: function() {
                return this.privProfileId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "errorDetails", {
            get: function() {
                return this.privErrorDetails
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "score", {
            get: function() {
                return this.privScore
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.SpeakerRecognitionResult = u;
    var p = function(e) {
        function t(t, r, n) {
            return e.call(this, t, r, n) || this
        }
        return i(t, e),
        t.fromResult = function(e) {
            var r = c.CancellationReason.Error
              , n = c.CancellationErrorCode.NoError;
            return e.properties && (n = c.CancellationErrorCode[e.properties.getProperty(s.CancellationErrorCodePropertyName, c.CancellationErrorCode[c.CancellationErrorCode.NoError])]),
            new t(r,e.errorDetails,n)
        }
        ,
        t
    }(c.CancellationDetailsBase);
    t.SpeakerRecognitionCancellationDetails = p
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    });
    var n = r(145);
    Object.defineProperty(t, "Conversation", {
        enumerable: !0,
        get: function() {
            return n.Conversation
        }
    }),
    Object.defineProperty(t, "ConversationImpl", {
        enumerable: !0,
        get: function() {
            return n.ConversationImpl
        }
    });
    var i = r(146);
    Object.defineProperty(t, "ConversationCommon", {
        enumerable: !0,
        get: function() {
            return i.ConversationCommon
        }
    });
    var o = r(147);
    Object.defineProperty(t, "ConversationExpirationEventArgs", {
        enumerable: !0,
        get: function() {
            return o.ConversationExpirationEventArgs
        }
    });
    var s = r(148);
    Object.defineProperty(t, "ConversationParticipantsChangedEventArgs", {
        enumerable: !0,
        get: function() {
            return s.ConversationParticipantsChangedEventArgs
        }
    });
    var a = r(149);
    Object.defineProperty(t, "ConversationTranslationCanceledEventArgs", {
        enumerable: !0,
        get: function() {
            return a.ConversationTranslationCanceledEventArgs
        }
    });
    var c = r(150);
    Object.defineProperty(t, "ConversationTranslationEventArgs", {
        enumerable: !0,
        get: function() {
            return c.ConversationTranslationEventArgs
        }
    });
    var u = r(151);
    Object.defineProperty(t, "ConversationTranslationResult", {
        enumerable: !0,
        get: function() {
            return u.ConversationTranslationResult
        }
    });
    var p = r(152);
    Object.defineProperty(t, "ConversationTranslator", {
        enumerable: !0,
        get: function() {
            return p.ConversationTranslator
        }
    });
    var l = r(153);
    Object.defineProperty(t, "ConversationTranscriber", {
        enumerable: !0,
        get: function() {
            return l.ConversationTranscriber
        }
    });
    var f = r(154);
    Object.defineProperty(t, "Participant", {
        enumerable: !0,
        get: function() {
            return f.Participant
        }
    }),
    Object.defineProperty(t, "User", {
        enumerable: !0,
        get: function() {
            return f.User
        }
    });
    var h = r(155);
    Object.defineProperty(t, "ParticipantChangedReason", {
        enumerable: !0,
        get: function() {
            return h.ParticipantChangedReason
        }
    })
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    ), o = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
    , s = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    , a = this && this.__spreadArrays || function() {
        for (var e = 0, t = 0, r = arguments.length; t < r; t++)
            e += arguments[t].length;
        var n = Array(e)
          , i = 0;
        for (t = 0; t < r; t++)
            for (var o = arguments[t], s = 0, a = o.length; s < a; s++,
            i++)
                n[i] = o[s];
        return n
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConversationImpl = t.Conversation = void 0;
    var c = r(53)
      , u = r(4)
      , p = r(63)
      , l = r(61)
      , f = function() {
        function e() {}
        return e.createConversationAsync = function(e, t, r, n) {
            var i, o, s;
            return p.Contracts.throwIfNullOrUndefined(e, c.ConversationConnectionConfig.restErrors.invalidArgs.replace("{arg}", "config")),
            p.Contracts.throwIfNullOrUndefined(e.region, c.ConversationConnectionConfig.restErrors.invalidArgs.replace("{arg}", "SpeechServiceConnection_Region")),
            e.subscriptionKey || e.getProperty(l.PropertyId[l.PropertyId.SpeechServiceAuthorization_Token]) || p.Contracts.throwIfNullOrUndefined(e.subscriptionKey, c.ConversationConnectionConfig.restErrors.invalidArgs.replace("{arg}", "SpeechServiceConnection_Key")),
            "string" == typeof t ? (i = new h(e,t),
            o = r,
            s = n) : (i = new h(e),
            o = t,
            s = r),
            i.createConversationAsync((function() {
                o && o()
            }
            ), (function(e) {
                s && s(e)
            }
            )),
            i
        }
        ,
        e
    }();
    t.Conversation = f;
    var h = function(e) {
        function t(t, r) {
            var n = e.call(this) || this;
            if (n.privIsDisposed = !1,
            n.privIsConnected = !1,
            n.privErrors = c.ConversationConnectionConfig.restErrors,
            n.privConversationId = "",
            n.onConnected = function(e) {
                var t, r;
                n.privIsConnected = !0;
                try {
                    (null === (t = n.privConversationTranslator) || void 0 === t ? void 0 : t.sessionStarted) && n.privConversationTranslator.sessionStarted(n.privConversationTranslator, e),
                    (null === (r = n.privTranscriberRecognizer) || void 0 === r ? void 0 : r.conversationStarted) && n.privTranscriberRecognizer.conversationStarted(n.privTranscriberRecognizer, e)
                } catch (e) {}
            }
            ,
            n.onDisconnected = function(e) {
                return o(n, void 0, void 0, (function() {
                    var t, r;
                    return s(this, (function(n) {
                        switch (n.label) {
                        case 0:
                            return n.trys.push([0, 1, 2, 4]),
                            (null === (t = this.privConversationTranslator) || void 0 === t ? void 0 : t.sessionStopped) && this.privConversationTranslator.sessionStopped(this.privConversationTranslator, e),
                            (null === (r = this.privTranscriberRecognizer) || void 0 === r ? void 0 : r.conversationStopped) && this.privTranscriberRecognizer.conversationStopped(this.privTranscriberRecognizer, e),
                            [3, 4];
                        case 1:
                            return n.sent(),
                            [3, 4];
                        case 2:
                            return [4, this.close(!1)];
                        case 3:
                            return n.sent(),
                            [7];
                        case 4:
                            return [2]
                        }
                    }
                    ))
                }
                ))
            }
            ,
            n.onCanceled = function(e, t) {
                return o(n, void 0, void 0, (function() {
                    var e, r;
                    return s(this, (function(n) {
                        try {
                            (null === (e = this.privConversationTranslator) || void 0 === e ? void 0 : e.canceled) && this.privConversationTranslator.canceled(this.privConversationTranslator, t),
                            (null === (r = this.privTranscriberRecognizer) || void 0 === r ? void 0 : r.conversationCanceled) && this.privTranscriberRecognizer.conversationCanceled(this.privTranscriberRecognizer, t)
                        } catch (e) {}
                        return [2]
                    }
                    ))
                }
                ))
            }
            ,
            n.onParticipantUpdateCommandReceived = function(e, t) {
                var r, i;
                try {
                    var o = n.privParticipants.getParticipant(t.id);
                    if (void 0 !== o) {
                        switch (t.key) {
                        case c.ConversationTranslatorCommandTypes.changeNickname:
                            o.displayName = t.value;
                            break;
                        case c.ConversationTranslatorCommandTypes.setUseTTS:
                            o.useTts = t.value;
                            break;
                        case c.ConversationTranslatorCommandTypes.setProfanityFiltering:
                            o.profanity = t.value;
                            break;
                        case c.ConversationTranslatorCommandTypes.setMute:
                            o.isMuted = t.value;
                            break;
                        case c.ConversationTranslatorCommandTypes.setTranslateToLanguages:
                            o.translateToLanguages = t.value
                        }
                        n.privParticipants.addOrUpdateParticipant(o),
                        (null === (r = n.privConversationTranslator) || void 0 === r ? void 0 : r.participantsChanged) && (null === (i = n.privConversationTranslator) || void 0 === i || i.participantsChanged(n.privConversationTranslator, new l.ConversationParticipantsChangedEventArgs(l.ParticipantChangedReason.Updated,[n.toParticipant(o)],t.sessionId)))
                    }
                } catch (t) {}
            }
            ,
            n.onLockRoomCommandReceived = function(e, t) {}
            ,
            n.onMuteAllCommandReceived = function(e, t) {
                var r, i;
                try {
                    n.privParticipants.participants.forEach((function(e) {
                        return e.isMuted = !e.isHost && t.isMuted
                    }
                    )),
                    (null === (r = n.privConversationTranslator) || void 0 === r ? void 0 : r.participantsChanged) && (null === (i = n.privConversationTranslator) || void 0 === i || i.participantsChanged(n.privConversationTranslator, new l.ConversationParticipantsChangedEventArgs(l.ParticipantChangedReason.Updated,n.toParticipants(!1),t.sessionId)))
                } catch (t) {}
            }
            ,
            n.onParticipantJoinCommandReceived = function(e, t) {
                var r, i;
                try {
                    var o = n.privParticipants.addOrUpdateParticipant(t.participant);
                    void 0 !== o && (null === (r = n.privConversationTranslator) || void 0 === r ? void 0 : r.participantsChanged) && (null === (i = n.privConversationTranslator) || void 0 === i || i.participantsChanged(n.privConversationTranslator, new l.ConversationParticipantsChangedEventArgs(l.ParticipantChangedReason.JoinedConversation,[n.toParticipant(o)],t.sessionId)))
                } catch (t) {}
            }
            ,
            n.onParticipantLeaveCommandReceived = function(e, t) {
                var r, i;
                try {
                    var o = n.privParticipants.getParticipant(t.participant.id);
                    void 0 !== o && (n.privParticipants.deleteParticipant(t.participant.id),
                    (null === (r = n.privConversationTranslator) || void 0 === r ? void 0 : r.participantsChanged) && (null === (i = n.privConversationTranslator) || void 0 === i || i.participantsChanged(n.privConversationTranslator, new l.ConversationParticipantsChangedEventArgs(l.ParticipantChangedReason.LeftConversation,[n.toParticipant(o)],t.sessionId))))
                } catch (t) {}
            }
            ,
            n.onTranslationReceived = function(e, t) {
                var r, i, o, s, a, u;
                try {
                    switch (t.command) {
                    case c.ConversationTranslatorMessageTypes.final:
                        (null === (r = n.privConversationTranslator) || void 0 === r ? void 0 : r.transcribed) && (null === (i = n.privConversationTranslator) || void 0 === i || i.transcribed(n.privConversationTranslator, new l.ConversationTranslationEventArgs(t.payload,void 0,t.sessionId)));
                        break;
                    case c.ConversationTranslatorMessageTypes.partial:
                        (null === (o = n.privConversationTranslator) || void 0 === o ? void 0 : o.transcribing) && (null === (s = n.privConversationTranslator) || void 0 === s || s.transcribing(n.privConversationTranslator, new l.ConversationTranslationEventArgs(t.payload,void 0,t.sessionId)));
                        break;
                    case c.ConversationTranslatorMessageTypes.instantMessage:
                        (null === (a = n.privConversationTranslator) || void 0 === a ? void 0 : a.textMessageReceived) && (null === (u = n.privConversationTranslator) || void 0 === u || u.textMessageReceived(n.privConversationTranslator, new l.ConversationTranslationEventArgs(t.payload,void 0,t.sessionId)))
                    }
                } catch (t) {}
            }
            ,
            n.onParticipantsListReceived = function(e, t) {
                var r, i, o;
                try {
                    if (void 0 !== t.sessionToken && null !== t.sessionToken && (n.privRoom.token = t.sessionToken),
                    n.privParticipants.participants = a(t.participants),
                    void 0 !== n.privParticipants.me && (n.privIsReady = !0),
                    (null === (r = n.privConversationTranslator) || void 0 === r ? void 0 : r.participantsChanged) && (null === (i = n.privConversationTranslator) || void 0 === i || i.participantsChanged(n.privConversationTranslator, new l.ConversationParticipantsChangedEventArgs(l.ParticipantChangedReason.JoinedConversation,n.toParticipants(!0),t.sessionId))),
                    n.me.isHost) {
                        var s = null === (o = n.privConversationTranslator) || void 0 === o ? void 0 : o.properties.getProperty(l.PropertyId.ConversationTranslator_Name);
                        void 0 !== s && s.length > 0 && s !== n.me.displayName && n.changeNicknameAsync(s)
                    }
                } catch (t) {}
            }
            ,
            n.onConversationExpiration = function(e, t) {
                var r, i;
                try {
                    (null === (r = n.privConversationTranslator) || void 0 === r ? void 0 : r.conversationExpiration) && (null === (i = n.privConversationTranslator) || void 0 === i || i.conversationExpiration(n.privConversationTranslator, t))
                } catch (t) {}
            }
            ,
            n.privProperties = new l.PropertyCollection,
            n.privManager = new c.ConversationManager,
            t.getProperty(l.PropertyId[l.PropertyId.SpeechServiceConnection_RecoLanguage]) || t.setProperty(l.PropertyId[l.PropertyId.SpeechServiceConnection_RecoLanguage], c.ConversationConnectionConfig.defaultLanguageCode),
            n.privLanguage = t.getProperty(l.PropertyId[l.PropertyId.SpeechServiceConnection_RecoLanguage]),
            r)
                n.privConversationId = r;
            else {
                0 === t.targetLanguages.length && t.addTargetLanguage(n.privLanguage),
                t.getProperty(l.PropertyId[l.PropertyId.SpeechServiceResponse_ProfanityOption]) || t.setProfanity(l.ProfanityOption.Masked);
                var i = t.getProperty(l.PropertyId[l.PropertyId.ConversationTranslator_Name]);
                (null == i || i.length <= 1 || i.length > 50) && (i = "Host"),
                t.setProperty(l.PropertyId[l.PropertyId.ConversationTranslator_Name], i)
            }
            n.privConfig = t;
            var u = t;
            return p.Contracts.throwIfNull(u, "speechConfig"),
            n.privProperties = u.properties.clone(),
            n.privIsConnected = !1,
            n.privParticipants = new c.InternalParticipants,
            n.privIsReady = !1,
            n.privTextMessageMaxLength = 1e3,
            n
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "conversationTranslator", {
            set: function(e) {
                this.privConversationTranslator = e
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "room", {
            get: function() {
                return this.privRoom
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "connection", {
            get: function() {
                return this.privConversationRecognizer
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "authorizationToken", {
            get: function() {
                return this.privToken
            },
            set: function(e) {
                p.Contracts.throwIfNullOrWhitespace(e, "authorizationToken"),
                this.privToken = e
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "config", {
            get: function() {
                return this.privConfig
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "conversationId", {
            get: function() {
                return this.privRoom ? this.privRoom.roomId : this.privConversationId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "speechRecognitionLanguage", {
            get: function() {
                return this.privLanguage
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "isMutedByHost", {
            get: function() {
                var e, t;
                return !(null === (e = this.privParticipants.me) || void 0 === e ? void 0 : e.isHost) && (null === (t = this.privParticipants.me) || void 0 === t ? void 0 : t.isMuted)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "isConnected", {
            get: function() {
                return this.privIsConnected && this.privIsReady
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "participants", {
            get: function() {
                return this.toParticipants(!0)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "me", {
            get: function() {
                return this.toParticipant(this.privParticipants.me)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "host", {
            get: function() {
                return this.toParticipant(this.privParticipants.host)
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.createConversationAsync = function(e, t) {
            var r = this;
            try {
                this.privConversationRecognizer && this.handleError(new Error(this.privErrors.permissionDeniedStart), t),
                this.privManager.createOrJoin(this.privProperties, void 0, (function(n) {
                    n || r.handleError(new Error(r.privErrors.permissionDeniedConnect), t),
                    r.privRoom = n,
                    r.handleCallback(e, t)
                }
                ), (function(e) {
                    r.handleError(e, t)
                }
                ))
            } catch (e) {
                this.handleError(e, t)
            }
        }
        ,
        t.prototype.startConversationAsync = function(e, t) {
            var r = this;
            try {
                this.privConversationRecognizer && this.handleError(new Error(this.privErrors.permissionDeniedStart), t),
                p.Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedConnect),
                this.privParticipants.meId = this.privRoom.participantId,
                this.privConversationRecognizer = c.ConversationRecognizerFactory.fromConfig(this, this.privConfig),
                this.privConversationRecognizer.connected = this.onConnected,
                this.privConversationRecognizer.disconnected = this.onDisconnected,
                this.privConversationRecognizer.canceled = this.onCanceled,
                this.privConversationRecognizer.participantUpdateCommandReceived = this.onParticipantUpdateCommandReceived,
                this.privConversationRecognizer.lockRoomCommandReceived = this.onLockRoomCommandReceived,
                this.privConversationRecognizer.muteAllCommandReceived = this.onMuteAllCommandReceived,
                this.privConversationRecognizer.participantJoinCommandReceived = this.onParticipantJoinCommandReceived,
                this.privConversationRecognizer.participantLeaveCommandReceived = this.onParticipantLeaveCommandReceived,
                this.privConversationRecognizer.translationReceived = this.onTranslationReceived,
                this.privConversationRecognizer.participantsListReceived = this.onParticipantsListReceived,
                this.privConversationRecognizer.conversationExpiration = this.onConversationExpiration,
                this.privConversationRecognizer.connect(this.privRoom.token, (function() {
                    r.handleCallback(e, t)
                }
                ), (function(e) {
                    r.handleError(e, t)
                }
                ))
            } catch (e) {
                this.handleError(e, t)
            }
        }
        ,
        t.prototype.addParticipantAsync = function(e, t, r) {
            p.Contracts.throwIfNullOrUndefined(e, "Participant"),
            u.marshalPromiseToCallbacks(this.addParticipantImplAsync(e), t, r)
        }
        ,
        t.prototype.joinConversationAsync = function(e, t, r, n, i) {
            var o = this;
            try {
                p.Contracts.throwIfNullOrWhitespace(e, this.privErrors.invalidArgs.replace("{arg}", "conversationId")),
                p.Contracts.throwIfNullOrWhitespace(t, this.privErrors.invalidArgs.replace("{arg}", "nickname")),
                p.Contracts.throwIfNullOrWhitespace(r, this.privErrors.invalidArgs.replace("{arg}", "language")),
                this.privManager.createOrJoin(this.privProperties, e, (function(e) {
                    p.Contracts.throwIfNullOrUndefined(e, o.privErrors.permissionDeniedConnect),
                    o.privRoom = e,
                    o.privConfig.authorizationToken = e.cognitiveSpeechAuthToken,
                    n && n(e.cognitiveSpeechAuthToken)
                }
                ), (function(e) {
                    o.handleError(e, i)
                }
                ))
            } catch (e) {
                this.handleError(e, i)
            }
        }
        ,
        t.prototype.deleteConversationAsync = function(e, t) {
            u.marshalPromiseToCallbacks(this.deleteConversationImplAsync(), e, t)
        }
        ,
        t.prototype.deleteConversationImplAsync = function() {
            return o(this, void 0, void 0, (function() {
                return s(this, (function(e) {
                    switch (e.label) {
                    case 0:
                        return p.Contracts.throwIfNullOrUndefined(this.privProperties, this.privErrors.permissionDeniedConnect),
                        p.Contracts.throwIfNullOrWhitespace(this.privRoom.token, this.privErrors.permissionDeniedConnect),
                        [4, this.privManager.leave(this.privProperties, this.privRoom.token)];
                    case 1:
                        return e.sent(),
                        this.dispose(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.endConversationAsync = function(e, t) {
            u.marshalPromiseToCallbacks(this.endConversationImplAsync(), e, t)
        }
        ,
        t.prototype.endConversationImplAsync = function() {
            return this.close(!0)
        }
        ,
        t.prototype.lockConversationAsync = function(e, t) {
            var r, n = this;
            try {
                p.Contracts.throwIfDisposed(this.privIsDisposed),
                p.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),
                p.Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend),
                this.canSendAsHost || this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace("{command}", "lock")), t),
                null === (r = this.privConversationRecognizer) || void 0 === r || r.sendRequest(this.getLockCommand(!0), (function() {
                    n.handleCallback(e, t)
                }
                ), (function(e) {
                    n.handleError(e, t)
                }
                ))
            } catch (e) {
                this.handleError(e, t)
            }
        }
        ,
        t.prototype.muteAllParticipantsAsync = function(e, t) {
            var r, n = this;
            try {
                p.Contracts.throwIfDisposed(this.privIsDisposed),
                p.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),
                p.Contracts.throwIfNullOrUndefined(this.privConversationRecognizer, this.privErrors.permissionDeniedSend),
                p.Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend),
                this.canSendAsHost || this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace("{command}", "mute")), t),
                null === (r = this.privConversationRecognizer) || void 0 === r || r.sendRequest(this.getMuteAllCommand(!0), (function() {
                    n.handleCallback(e, t)
                }
                ), (function(e) {
                    n.handleError(e, t)
                }
                ))
            } catch (e) {
                this.handleError(e, t)
            }
        }
        ,
        t.prototype.muteParticipantAsync = function(e, t, r) {
            var n, i = this;
            try {
                p.Contracts.throwIfDisposed(this.privIsDisposed),
                p.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),
                p.Contracts.throwIfNullOrWhitespace(e, this.privErrors.invalidArgs.replace("{arg}", "userId")),
                p.Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend),
                this.canSend || this.handleError(new Error(this.privErrors.permissionDeniedSend), r),
                this.me.isHost || this.me.id === e || this.handleError(new Error(this.privErrors.permissionDeniedParticipant.replace("{command}", "mute")), r),
                -1 === this.privParticipants.getParticipantIndex(e) && this.handleError(new Error(this.privErrors.invalidParticipantRequest), r),
                null === (n = this.privConversationRecognizer) || void 0 === n || n.sendRequest(this.getMuteCommand(e, !0), (function() {
                    i.handleCallback(t, r)
                }
                ), (function(e) {
                    i.handleError(e, r)
                }
                ))
            } catch (e) {
                this.handleError(e, r)
            }
        }
        ,
        t.prototype.removeParticipantAsync = function(e, t, r) {
            var n, i = this;
            try {
                if (p.Contracts.throwIfDisposed(this.privIsDisposed),
                this.privTranscriberRecognizer && e.hasOwnProperty("id"))
                    u.marshalPromiseToCallbacks(this.removeParticipantImplAsync(e), t, r);
                else {
                    p.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),
                    p.Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend),
                    this.canSendAsHost || this.handleError(new Error(this.privErrors.permissionDeniedParticipant.replace("{command}", "remove")), r);
                    var o = "";
                    if ("string" == typeof e)
                        o = e;
                    else if (e.hasOwnProperty("id")) {
                        o = e.id
                    } else if (e.hasOwnProperty("userId")) {
                        o = e.userId
                    }
                    p.Contracts.throwIfNullOrWhitespace(o, this.privErrors.invalidArgs.replace("{arg}", "userId")),
                    -1 === this.participants.findIndex((function(e) {
                        return e.id === o
                    }
                    )) && this.handleError(new Error(this.privErrors.invalidParticipantRequest), r),
                    null === (n = this.privConversationRecognizer) || void 0 === n || n.sendRequest(this.getEjectCommand(o), (function() {
                        i.handleCallback(t, r)
                    }
                    ), (function(e) {
                        i.handleError(e, r)
                    }
                    ))
                }
            } catch (e) {
                this.handleError(e, r)
            }
        }
        ,
        t.prototype.unlockConversationAsync = function(e, t) {
            var r, n = this;
            try {
                p.Contracts.throwIfDisposed(this.privIsDisposed),
                p.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),
                p.Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend),
                this.canSendAsHost || this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace("{command}", "unlock")), t),
                null === (r = this.privConversationRecognizer) || void 0 === r || r.sendRequest(this.getLockCommand(!1), (function() {
                    n.handleCallback(e, t)
                }
                ), (function(e) {
                    n.handleError(e, t)
                }
                ))
            } catch (e) {
                this.handleError(e, t)
            }
        }
        ,
        t.prototype.unmuteAllParticipantsAsync = function(e, t) {
            var r, n = this;
            try {
                p.Contracts.throwIfDisposed(this.privIsDisposed),
                p.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),
                p.Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend),
                this.canSendAsHost || this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace("{command}", "unmute all")), t),
                null === (r = this.privConversationRecognizer) || void 0 === r || r.sendRequest(this.getMuteAllCommand(!1), (function() {
                    n.handleCallback(e, t)
                }
                ), (function(e) {
                    n.handleError(e, t)
                }
                ))
            } catch (e) {
                this.handleError(e, t)
            }
        }
        ,
        t.prototype.unmuteParticipantAsync = function(e, t, r) {
            var n, i = this;
            try {
                p.Contracts.throwIfDisposed(this.privIsDisposed),
                p.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),
                p.Contracts.throwIfNullOrWhitespace(e, this.privErrors.invalidArgs.replace("{arg}", "userId")),
                p.Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend),
                this.canSend || this.handleError(new Error(this.privErrors.permissionDeniedSend), r),
                this.me.isHost || this.me.id === e || this.handleError(new Error(this.privErrors.permissionDeniedParticipant.replace("{command}", "mute")), r),
                -1 === this.privParticipants.getParticipantIndex(e) && this.handleError(new Error(this.privErrors.invalidParticipantRequest), r),
                null === (n = this.privConversationRecognizer) || void 0 === n || n.sendRequest(this.getMuteCommand(e, !1), (function() {
                    i.handleCallback(t, r)
                }
                ), (function(e) {
                    i.handleError(e, r)
                }
                ))
            } catch (e) {
                this.handleError(e, r)
            }
        }
        ,
        t.prototype.sendTextMessageAsync = function(e, t, r) {
            var n, i = this;
            try {
                p.Contracts.throwIfDisposed(this.privIsDisposed),
                p.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),
                p.Contracts.throwIfNullOrWhitespace(e, this.privErrors.invalidArgs.replace("{arg}", "message")),
                p.Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend),
                this.canSend || this.handleError(new Error(this.privErrors.permissionDeniedSend), r),
                e.length > this.privTextMessageMaxLength && this.handleError(new Error(this.privErrors.invalidArgs.replace("{arg}", "message length")), r),
                null === (n = this.privConversationRecognizer) || void 0 === n || n.sendRequest(this.getMessageCommand(e), (function() {
                    i.handleCallback(t, r)
                }
                ), (function(e) {
                    i.handleError(e, r)
                }
                ))
            } catch (e) {
                this.handleError(e, r)
            }
        }
        ,
        t.prototype.changeNicknameAsync = function(e, t, r) {
            var n, i = this;
            try {
                p.Contracts.throwIfDisposed(this.privIsDisposed),
                p.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),
                p.Contracts.throwIfNullOrWhitespace(e, this.privErrors.invalidArgs.replace("{arg}", "nickname")),
                p.Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend),
                this.canSend || this.handleError(new Error(this.privErrors.permissionDeniedSend), r),
                null === (n = this.privConversationRecognizer) || void 0 === n || n.sendRequest(this.getChangeNicknameCommand(e), (function() {
                    i.handleCallback(t, r)
                }
                ), (function(e) {
                    i.handleError(e, r)
                }
                ))
            } catch (e) {
                this.handleError(e, r)
            }
        }
        ,
        t.prototype.isDisposed = function() {
            return this.privIsDisposed
        }
        ,
        t.prototype.dispose = function(e) {
            var t;
            this.isDisposed || (this.privIsDisposed = !0,
            null === (t = this.config) || void 0 === t || t.close(),
            this.privConfig = void 0,
            this.privLanguage = void 0,
            this.privProperties = void 0,
            this.privRoom = void 0,
            this.privToken = void 0,
            this.privManager = void 0,
            this.privIsConnected = !1,
            this.privIsReady = !1,
            this.privParticipants = void 0)
        }
        ,
        Object.defineProperty(t.prototype, "transcriberRecognizer", {
            get: function() {
                return this.privTranscriberRecognizer
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.connectTranscriberRecognizer = function(e) {
            return o(this, void 0, void 0, (function() {
                return s(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return this.privTranscriberRecognizer ? [4, this.privTranscriberRecognizer.close()] : [3, 2];
                    case 1:
                        t.sent(),
                        t.label = 2;
                    case 2:
                        return this.privTranscriberRecognizer = e,
                        this.privTranscriberRecognizer.conversation = this,
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        Object.defineProperty(t.prototype, "conversationInfo", {
            get: function() {
                for (var e = this.conversationId, t = this.participants.map((function(e) {
                    return {
                        id: e.id,
                        preferredLanguage: e.preferredLanguage,
                        voice: e.voice
                    }
                }
                )), r = {}, n = 0, i = c.ConversationConnectionConfig.transcriptionEventKeys; n < i.length; n++) {
                    var o = i[n]
                      , s = this.properties.getProperty(o, "");
                    "" !== s && (r[o] = s)
                }
                return {
                    id: e,
                    participants: t,
                    conversationProperties: r
                }
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.getKeepAlive = function() {
            var e = this.me ? this.me.displayName : "default_nickname";
            return JSON.stringify({
                id: "0",
                nickname: e,
                participantId: this.privRoom.participantId,
                roomId: this.privRoom.roomId,
                type: c.ConversationTranslatorMessageTypes.keepAlive
            })
        }
        ,
        t.prototype.addParticipantImplAsync = function(e) {
            if (void 0 !== this.privParticipants.addOrUpdateParticipant(e) && this.privTranscriberRecognizer) {
                var t = this.conversationInfo;
                return t.participants = [e],
                this.privTranscriberRecognizer.pushConversationEvent(t, "join")
            }
        }
        ,
        t.prototype.removeParticipantImplAsync = function(e) {
            this.privParticipants.deleteParticipant(e.id);
            var t = this.conversationInfo;
            return t.participants = [e],
            this.privTranscriberRecognizer.pushConversationEvent(t, "leave")
        }
        ,
        t.prototype.close = function(e) {
            var t, r;
            return o(this, void 0, void 0, (function() {
                return s(this, (function(n) {
                    switch (n.label) {
                    case 0:
                        return n.trys.push([0, 2, , 3]),
                        this.privIsConnected = !1,
                        [4, null === (t = this.privConversationRecognizer) || void 0 === t ? void 0 : t.close()];
                    case 1:
                        return n.sent(),
                        this.privConversationRecognizer = void 0,
                        null === (r = this.privConversationTranslator) || void 0 === r || r.dispose(),
                        [3, 3];
                    case 2:
                        throw n.sent();
                    case 3:
                        return e && this.dispose(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        Object.defineProperty(t.prototype, "canSend", {
            get: function() {
                var e;
                return this.privIsConnected && !(null === (e = this.privParticipants.me) || void 0 === e ? void 0 : e.isMuted)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "canSendAsHost", {
            get: function() {
                var e;
                return this.privIsConnected && (null === (e = this.privParticipants.me) || void 0 === e ? void 0 : e.isHost)
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.handleCallback = function(e, t) {
            if (e) {
                try {
                    e()
                } catch (e) {
                    t && t(e)
                }
                e = void 0
            }
        }
        ,
        t.prototype.handleError = function(e, t) {
            if (t)
                if (e instanceof Error) {
                    var r = e;
                    t(r.name + ": " + r.message)
                } else
                    t(e)
        }
        ,
        t.prototype.toParticipants = function(e) {
            var t = this
              , r = this.privParticipants.participants.map((function(e) {
                return t.toParticipant(e)
            }
            ));
            return e ? r : r.filter((function(e) {
                return !1 === e.isHost
            }
            ))
        }
        ,
        t.prototype.toParticipant = function(e) {
            return new l.Participant(e.id,e.avatar,e.displayName,e.isHost,e.isMuted,e.isUsingTts,e.preferredLanguage,e.voice)
        }
        ,
        t.prototype.getMuteAllCommand = function(e) {
            return p.Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, "conversationId"),
            p.Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, "participantId"),
            JSON.stringify({
                command: c.ConversationTranslatorCommandTypes.setMuteAll,
                participantId: this.privRoom.participantId,
                roomid: this.privRoom.roomId,
                type: c.ConversationTranslatorMessageTypes.participantCommand,
                value: e
            })
        }
        ,
        t.prototype.getMuteCommand = function(e, t) {
            return p.Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, "conversationId"),
            p.Contracts.throwIfNullOrWhitespace(e, "participantId"),
            JSON.stringify({
                command: c.ConversationTranslatorCommandTypes.setMute,
                participantId: e,
                roomid: this.privRoom.roomId,
                type: c.ConversationTranslatorMessageTypes.participantCommand,
                value: t
            })
        }
        ,
        t.prototype.getLockCommand = function(e) {
            return p.Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, "conversationId"),
            p.Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, "participantId"),
            JSON.stringify({
                command: c.ConversationTranslatorCommandTypes.setLockState,
                participantId: this.privRoom.participantId,
                roomid: this.privRoom.roomId,
                type: c.ConversationTranslatorMessageTypes.participantCommand,
                value: e
            })
        }
        ,
        t.prototype.getEjectCommand = function(e) {
            return p.Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, "conversationId"),
            p.Contracts.throwIfNullOrWhitespace(e, "participantId"),
            JSON.stringify({
                command: c.ConversationTranslatorCommandTypes.ejectParticipant,
                participantId: e,
                roomid: this.privRoom.roomId,
                type: c.ConversationTranslatorMessageTypes.participantCommand
            })
        }
        ,
        t.prototype.getChangeNicknameCommand = function(e) {
            return p.Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, "conversationId"),
            p.Contracts.throwIfNullOrWhitespace(e, "nickname"),
            p.Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, "participantId"),
            JSON.stringify({
                command: c.ConversationTranslatorCommandTypes.changeNickname,
                nickname: e,
                participantId: this.privRoom.participantId,
                roomid: this.privRoom.roomId,
                type: c.ConversationTranslatorMessageTypes.participantCommand,
                value: e
            })
        }
        ,
        t.prototype.getMessageCommand = function(e) {
            return p.Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, "conversationId"),
            p.Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, "participantId"),
            p.Contracts.throwIfNullOrWhitespace(e, "message"),
            JSON.stringify({
                participantId: this.privRoom.participantId,
                roomId: this.privRoom.roomId,
                text: e,
                type: c.ConversationTranslatorMessageTypes.instantMessage
            })
        }
        ,
        t
    }(f);
    t.ConversationImpl = h
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConversationCommon = void 0;
    var n = function() {
        function e(e) {
            this.privAudioConfig = e
        }
        return e.prototype.handleCallback = function(e, t) {
            if (e) {
                try {
                    e()
                } catch (e) {
                    t && t(e)
                }
                e = void 0
            }
        }
        ,
        e.prototype.handleError = function(e, t) {
            if (t)
                if (e instanceof Error) {
                    var r = e;
                    t(r.name + ": " + r.message)
                } else
                    t(e)
        }
        ,
        e
    }();
    t.ConversationCommon = n
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConversationExpirationEventArgs = void 0;
    var o = function(e) {
        function t(t, r) {
            var n = e.call(this, r) || this;
            return n.privExpirationTime = t,
            n
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "expirationTime", {
            get: function() {
                return this.privExpirationTime
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(r(61).SessionEventArgs);
    t.ConversationExpirationEventArgs = o
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConversationParticipantsChangedEventArgs = void 0;
    var o = function(e) {
        function t(t, r, n) {
            var i = e.call(this, n) || this;
            return i.privReason = t,
            i.privParticipant = r,
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "reason", {
            get: function() {
                return this.privReason
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "participants", {
            get: function() {
                return this.privParticipant
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(r(61).SessionEventArgs);
    t.ConversationParticipantsChangedEventArgs = o
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConversationTranslationCanceledEventArgs = void 0;
    var o = function(e) {
        function t() {
            return null !== e && e.apply(this, arguments) || this
        }
        return i(t, e),
        t
    }(r(90).CancellationEventArgsBase);
    t.ConversationTranslationCanceledEventArgs = o
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConversationTranslationEventArgs = void 0;
    var o = function(e) {
        function t(t, r, n) {
            var i = e.call(this, r, n) || this;
            return i.privResult = t,
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "result", {
            get: function() {
                return this.privResult
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(r(61).RecognitionEventArgs);
    t.ConversationTranslationEventArgs = o
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConversationTranslationResult = void 0;
    var o = function(e) {
        function t(t, r, n, i, o, s, a, c, u, p, l) {
            var f = e.call(this, r, i, o, s, a, c, u, p, l) || this;
            return f.privId = t,
            f.privOrigLang = n,
            f
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "participantId", {
            get: function() {
                return this.privId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "originalLang", {
            get: function() {
                return this.privOrigLang
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(r(93).TranslationRecognitionResult);
    t.ConversationTranslationResult = o
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    ), o = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
    , s = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConversationTranslator = t.SpeechState = void 0;
    var a, c = r(53), u = r(4), p = r(63), l = r(61), f = r(145), h = r(144);
    !function(e) {
        e[e.Inactive = 0] = "Inactive",
        e[e.Connecting = 1] = "Connecting",
        e[e.Connected = 2] = "Connected"
    }(a = t.SpeechState || (t.SpeechState = {}));
    var v = function(e) {
        function t(t, r, n) {
            var i = e.call(this, t, r) || this;
            return i.privSpeechState = a.Inactive,
            n && (i.privTranslator = n,
            i.sessionStarted = function() {
                i.privSpeechState = a.Connected
            }
            ,
            i.sessionStopped = function() {
                i.privSpeechState = a.Inactive
            }
            ,
            i.recognized = function(e, t) {
                return o(i, void 0, void 0, (function() {
                    var e;
                    return s(this, (function(r) {
                        switch (r.label) {
                        case 0:
                            return (null === (e = t.result) || void 0 === e ? void 0 : e.errorDetails) ? [4, this.cancelSpeech()] : [3, 2];
                        case 1:
                            r.sent(),
                            this.fireCancelEvent(t.result.errorDetails),
                            r.label = 2;
                        case 2:
                            return [2]
                        }
                    }
                    ))
                }
                ))
            }
            ,
            i.canceled = function(e, t) {
                return o(i, void 0, void 0, (function() {
                    return s(this, (function(e) {
                        switch (e.label) {
                        case 0:
                            if (this.privSpeechState === a.Inactive)
                                return [3, 4];
                            e.label = 1;
                        case 1:
                            return e.trys.push([1, 3, , 4]),
                            [4, this.cancelSpeech()];
                        case 2:
                            return e.sent(),
                            [3, 4];
                        case 3:
                            return e.sent(),
                            this.privSpeechState = a.Inactive,
                            [3, 4];
                        case 4:
                            return [2]
                        }
                    }
                    ))
                }
                ))
            }
            ),
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "state", {
            get: function() {
                return this.privSpeechState
            },
            set: function(e) {
                this.privSpeechState = e
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.onConnection = function() {
            this.privSpeechState = a.Connected
        }
        ,
        t.prototype.onDisconnection = function() {
            return o(this, void 0, void 0, (function() {
                return s(this, (function(e) {
                    switch (e.label) {
                    case 0:
                        return this.privSpeechState = a.Inactive,
                        [4, this.cancelSpeech()];
                    case 1:
                        return e.sent(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.fireCancelEvent = function(e) {
            var t, r, n;
            try {
                if (this.privTranslator.canceled) {
                    var i = new h.ConversationTranslationCanceledEventArgs(null !== (t = null == e ? void 0 : e.reason) && void 0 !== t ? t : l.CancellationReason.Error,null !== (r = null == e ? void 0 : e.errorDetails) && void 0 !== r ? r : e,null !== (n = null == e ? void 0 : e.errorCode) && void 0 !== n ? n : l.CancellationErrorCode.RuntimeError,void 0,null == e ? void 0 : e.sessionId);
                    this.privTranslator.canceled(this.privTranslator, i)
                }
            } catch (e) {}
        }
        ,
        t.prototype.cancelSpeech = function() {
            var e;
            return o(this, void 0, void 0, (function() {
                return s(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return t.trys.push([0, 2, , 3]),
                        this.stopContinuousRecognitionAsync(),
                        [4, null === (e = this.privReco) || void 0 === e ? void 0 : e.disconnect()];
                    case 1:
                        return t.sent(),
                        this.privSpeechState = a.Inactive,
                        [3, 3];
                    case 2:
                        return t.sent(),
                        [3, 3];
                    case 3:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t
    }(l.TranslationRecognizer)
      , d = function(e) {
        function t(t) {
            var r = e.call(this, t) || this;
            return r.privIsDisposed = !1,
            r.privIsSpeaking = !1,
            r.privErrors = c.ConversationConnectionConfig.restErrors,
            r.privPlaceholderKey = "abcdefghijklmnopqrstuvwxyz012345",
            r.privPlaceholderRegion = "westus",
            r.privProperties = new l.PropertyCollection,
            r
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "speechRecognitionLanguage", {
            get: function() {
                return this.privSpeechRecognitionLanguage
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "participants", {
            get: function() {
                var e;
                return null === (e = this.privConversation) || void 0 === e ? void 0 : e.participants
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.joinConversationAsync = function(e, t, r, n, i) {
            var o = this;
            try {
                if ("string" == typeof e) {
                    p.Contracts.throwIfNullOrUndefined(e, this.privErrors.invalidArgs.replace("{arg}", "conversation id")),
                    p.Contracts.throwIfNullOrWhitespace(t, this.privErrors.invalidArgs.replace("{arg}", "nickname")),
                    this.privConversation && this.handleError(new Error(this.privErrors.permissionDeniedStart), i);
                    var s = r;
                    null != s && "" !== s || (s = c.ConversationConnectionConfig.defaultLanguageCode),
                    this.privSpeechTranslationConfig = l.SpeechTranslationConfig.fromSubscription(this.privPlaceholderKey, this.privPlaceholderRegion),
                    this.privSpeechTranslationConfig.setProfanity(l.ProfanityOption.Masked),
                    this.privSpeechTranslationConfig.addTargetLanguage(s),
                    this.privSpeechTranslationConfig.setProperty(l.PropertyId[l.PropertyId.SpeechServiceConnection_RecoLanguage], s),
                    this.privSpeechTranslationConfig.setProperty(l.PropertyId[l.PropertyId.ConversationTranslator_Name], t);
                    var a = this.privProperties.getProperty(l.PropertyId.ConversationTranslator_Host);
                    a && this.privSpeechTranslationConfig.setProperty(l.PropertyId[l.PropertyId.ConversationTranslator_Host], a);
                    var u = this.privProperties.getProperty(l.PropertyId.SpeechServiceConnection_Host);
                    u && this.privSpeechTranslationConfig.setProperty(l.PropertyId[l.PropertyId.SpeechServiceConnection_Host], u),
                    this.privConversation = new f.ConversationImpl(this.privSpeechTranslationConfig),
                    this.privConversation.conversationTranslator = this,
                    this.privConversation.joinConversationAsync(e, t, s, (function(e) {
                        e || o.handleError(new Error(o.privErrors.permissionDeniedConnect), i),
                        o.privSpeechTranslationConfig.authorizationToken = e,
                        o.privConversation.startConversationAsync((function() {
                            o.handleCallback(n, i)
                        }
                        ), (function(e) {
                            o.handleError(e, i)
                        }
                        ))
                    }
                    ), (function(e) {
                        o.handleError(e, i)
                    }
                    ))
                } else
                    "object" == typeof e ? (p.Contracts.throwIfNullOrUndefined(e, this.privErrors.invalidArgs.replace("{arg}", "conversation id")),
                    p.Contracts.throwIfNullOrWhitespace(t, this.privErrors.invalidArgs.replace("{arg}", "nickname")),
                    this.privProperties.setProperty(l.PropertyId.ConversationTranslator_Name, t),
                    this.privConversation = e,
                    this.privConversation.conversationTranslator = this,
                    p.Contracts.throwIfNullOrUndefined(this.privConversation, this.privErrors.permissionDeniedConnect),
                    p.Contracts.throwIfNullOrUndefined(this.privConversation.room.token, this.privErrors.permissionDeniedConnect),
                    this.privSpeechTranslationConfig = e.config,
                    this.handleCallback(r, n)) : this.handleError(new Error(this.privErrors.invalidArgs.replace("{arg}", "invalid conversation type")), n)
            } catch (e) {
                this.handleError(e, "string" == typeof r ? i : n)
            }
        }
        ,
        t.prototype.leaveConversationAsync = function(e, t) {
            var r = this;
            u.marshalPromiseToCallbacks(o(r, void 0, void 0, (function() {
                return s(this, (function(e) {
                    switch (e.label) {
                    case 0:
                        return [4, this.cancelSpeech()];
                    case 1:
                        return e.sent(),
                        [4, this.privConversation.endConversationImplAsync()];
                    case 2:
                        return e.sent(),
                        [4, this.privConversation.deleteConversationImplAsync()];
                    case 3:
                        return e.sent(),
                        this.dispose(),
                        [2]
                    }
                }
                ))
            }
            )), e, t)
        }
        ,
        t.prototype.sendTextMessageAsync = function(e, t, r) {
            var n;
            try {
                p.Contracts.throwIfNullOrUndefined(this.privConversation, this.privErrors.permissionDeniedSend),
                p.Contracts.throwIfNullOrWhitespace(e, this.privErrors.invalidArgs.replace("{arg}", e)),
                null === (n = this.privConversation) || void 0 === n || n.sendTextMessageAsync(e, t, r)
            } catch (e) {
                this.handleError(e, r)
            }
        }
        ,
        t.prototype.startTranscribingAsync = function(e, t) {
            var r = this;
            u.marshalPromiseToCallbacks(o(r, void 0, void 0, (function() {
                var e;
                return s(this, (function(r) {
                    switch (r.label) {
                    case 0:
                        return r.trys.push([0, 4, , 6]),
                        p.Contracts.throwIfNullOrUndefined(this.privConversation, this.privErrors.permissionDeniedSend),
                        p.Contracts.throwIfNullOrUndefined(this.privConversation.room.token, this.privErrors.permissionDeniedConnect),
                        void 0 !== this.privCTRecognizer ? [3, 2] : [4, this.connectTranslatorRecognizer()];
                    case 1:
                        r.sent(),
                        r.label = 2;
                    case 2:
                        return p.Contracts.throwIfNullOrUndefined(this.privCTRecognizer, this.privErrors.permissionDeniedSend),
                        this.canSpeak || this.handleError(new Error(this.privErrors.permissionDeniedSend), t),
                        [4, this.startContinuousRecognition()];
                    case 3:
                        return r.sent(),
                        this.privIsSpeaking = !0,
                        [3, 6];
                    case 4:
                        return e = r.sent(),
                        this.privIsSpeaking = !1,
                        [4, this.cancelSpeech()];
                    case 5:
                        throw r.sent(),
                        e;
                    case 6:
                        return [2]
                    }
                }
                ))
            }
            )), e, t)
        }
        ,
        t.prototype.stopTranscribingAsync = function(e, t) {
            var r = this;
            u.marshalPromiseToCallbacks(o(r, void 0, void 0, (function() {
                var e = this;
                return s(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return t.trys.push([0, 4, , 6]),
                        this.privIsSpeaking ? [3, 2] : [4, this.cancelSpeech()];
                    case 1:
                        return t.sent(),
                        [2];
                    case 2:
                        return this.privIsSpeaking = !1,
                        [4, new Promise((function(t, r) {
                            var n;
                            null === (n = e.privCTRecognizer) || void 0 === n || n.stopContinuousRecognitionAsync(t, r)
                        }
                        ))];
                    case 3:
                        return t.sent(),
                        [3, 6];
                    case 4:
                        return t.sent(),
                        [4, this.cancelSpeech()];
                    case 5:
                        return t.sent(),
                        [3, 6];
                    case 6:
                        return [2]
                    }
                }
                ))
            }
            )), e, t)
        }
        ,
        t.prototype.isDisposed = function() {
            return this.privIsDisposed
        }
        ,
        t.prototype.dispose = function(e, t, r) {
            var n = this;
            u.marshalPromiseToCallbacks(o(n, void 0, void 0, (function() {
                var e, t;
                return s(this, (function(r) {
                    switch (r.label) {
                    case 0:
                        return this.isDisposed && !this.privIsSpeaking ? [2] : [4, this.cancelSpeech()];
                    case 1:
                        return r.sent(),
                        this.privIsDisposed = !0,
                        null === (e = this.privSpeechTranslationConfig) || void 0 === e || e.close(),
                        this.privSpeechRecognitionLanguage = void 0,
                        this.privProperties = void 0,
                        this.privAudioConfig = void 0,
                        this.privSpeechTranslationConfig = void 0,
                        null === (t = this.privConversation) || void 0 === t || t.dispose(),
                        this.privConversation = void 0,
                        [2]
                    }
                }
                ))
            }
            )), t, r)
        }
        ,
        t.prototype.cancelSpeech = function() {
            var e;
            return o(this, void 0, void 0, (function() {
                return s(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return t.trys.push([0, 2, , 3]),
                        this.privIsSpeaking = !1,
                        [4, null === (e = this.privCTRecognizer) || void 0 === e ? void 0 : e.onDisconnection()];
                    case 1:
                        return t.sent(),
                        this.privCTRecognizer = void 0,
                        [3, 3];
                    case 2:
                        return t.sent(),
                        [3, 3];
                    case 3:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.connectTranslatorRecognizer = function() {
            return o(this, void 0, void 0, (function() {
                var e, t, r, n;
                return s(this, (function(i) {
                    switch (i.label) {
                    case 0:
                        return i.trys.push([0, 1, , 3]),
                        void 0 === this.privAudioConfig && (this.privAudioConfig = l.AudioConfig.fromDefaultMicrophoneInput()),
                        this.privSpeechTranslationConfig.getProperty(l.PropertyId[l.PropertyId.SpeechServiceConnection_Key]) === this.privPlaceholderKey && this.privSpeechTranslationConfig.setProperty(l.PropertyId[l.PropertyId.SpeechServiceConnection_Key], ""),
                        e = encodeURIComponent(this.privConversation.room.token),
                        t = (t = this.privSpeechTranslationConfig.getProperty(l.PropertyId[l.PropertyId.SpeechServiceConnection_Host], c.ConversationConnectionConfig.speechHost)).replace("{region}", this.privConversation.room.cognitiveSpeechRegion),
                        r = "wss://" + t + c.ConversationConnectionConfig.speechPath + "?" + c.ConversationConnectionConfig.configParams.token + "=" + e,
                        this.privSpeechTranslationConfig.setProperty(l.PropertyId[l.PropertyId.SpeechServiceConnection_Endpoint], r),
                        this.privCTRecognizer = new v(this.privSpeechTranslationConfig,this.privAudioConfig,this),
                        [3, 3];
                    case 1:
                        return n = i.sent(),
                        [4, this.cancelSpeech()];
                    case 2:
                        throw i.sent(),
                        n;
                    case 3:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.startContinuousRecognition = function() {
            var e = this;
            return new Promise((function(t, r) {
                e.privCTRecognizer.startContinuousRecognitionAsync(t, r)
            }
            ))
        }
        ,
        Object.defineProperty(t.prototype, "canSpeak", {
            get: function() {
                return !(!this.privConversation.isConnected || !this.privCTRecognizer) && (!this.privIsSpeaking && this.privCTRecognizer.state !== a.Connected && this.privCTRecognizer.state !== a.Connecting && !this.privConversation.isMutedByHost)
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(h.ConversationCommon);
    t.ConversationTranslator = d
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
      , i = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConversationTranscriber = void 0;
    var o = r(53)
      , s = r(4)
      , a = r(63)
      , c = r(61)
      , u = function() {
        function e(e) {
            this.privAudioConfig = e,
            this.privProperties = new c.PropertyCollection,
            this.privRecognizer = void 0,
            this.privDisposedRecognizer = !1
        }
        return e.prototype.joinConversationAsync = function(e, t, r) {
            var n = e;
            a.Contracts.throwIfNullOrUndefined(n, "Conversation"),
            this.privRecognizer = new o.TranscriberRecognizer(e.config,this.privAudioConfig),
            a.Contracts.throwIfNullOrUndefined(this.privRecognizer, "Recognizer"),
            this.privRecognizer.connectCallbacks(this),
            s.marshalPromiseToCallbacks(n.connectTranscriberRecognizer(this.privRecognizer), t, r)
        }
        ,
        Object.defineProperty(e.prototype, "authorizationToken", {
            get: function() {
                return this.properties.getProperty(c.PropertyId.SpeechServiceAuthorization_Token)
            },
            set: function(e) {
                a.Contracts.throwIfNullOrWhitespace(e, "token"),
                this.properties.setProperty(c.PropertyId.SpeechServiceAuthorization_Token, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "speechRecognitionLanguage", {
            get: function() {
                return a.Contracts.throwIfDisposed(this.privDisposedRecognizer),
                this.properties.getProperty(c.PropertyId.SpeechServiceConnection_RecoLanguage)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.startTranscribingAsync = function(e, t) {
            this.privRecognizer.startContinuousRecognitionAsync(e, t)
        }
        ,
        e.prototype.stopTranscribingAsync = function(e, t) {
            this.privRecognizer.stopContinuousRecognitionAsync(e, t)
        }
        ,
        e.prototype.leaveConversationAsync = function(e, t) {
            var r = this;
            this.privRecognizer.disconnectCallbacks(),
            s.marshalPromiseToCallbacks(n(r, void 0, void 0, (function() {
                return i(this, (function(e) {
                    return [2]
                }
                ))
            }
            )), e, t)
        }
        ,
        e.prototype.close = function(e, t) {
            a.Contracts.throwIfDisposed(this.privDisposedRecognizer),
            s.marshalPromiseToCallbacks(this.dispose(!0), e, t)
        }
        ,
        e.prototype.dispose = function(e) {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return this.privDisposedRecognizer ? [2] : this.privRecognizer ? [4, this.privRecognizer.close()] : [3, 2];
                    case 1:
                        t.sent(),
                        this.privRecognizer = void 0,
                        t.label = 2;
                    case 2:
                        return e && (this.privDisposedRecognizer = !0),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e
    }();
    t.ConversationTranscriber = u
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.Participant = t.User = void 0;
    var n = r(61)
      , i = function() {
        function e(e) {
            this.privUserId = e
        }
        return Object.defineProperty(e.prototype, "userId", {
            get: function() {
                return this.privUserId
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.User = i;
    var o = function() {
        function e(e, t, r, i, o, s, a, c) {
            this.privId = e,
            this.privAvatar = t,
            this.privDisplayName = r,
            this.privIsHost = i,
            this.privIsMuted = o,
            this.privIsUsingTts = s,
            this.privPreferredLanguage = a,
            this.privVoice = c,
            this.privProperties = new n.PropertyCollection
        }
        return e.From = function(t, r, n) {
            return new e(t,"",t,!1,!1,!1,r,n)
        }
        ,
        Object.defineProperty(e.prototype, "avatar", {
            get: function() {
                return this.privAvatar
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "displayName", {
            get: function() {
                return this.privDisplayName
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "id", {
            get: function() {
                return this.privId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "preferredLanguage", {
            get: function() {
                return this.privPreferredLanguage
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "isHost", {
            get: function() {
                return this.privIsHost
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "isMuted", {
            get: function() {
                return this.privIsMuted
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "isUsingTts", {
            get: function() {
                return this.privIsUsingTts
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "voice", {
            get: function() {
                return this.privVoice
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.Participant = o
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ParticipantChangedReason = void 0,
    function(e) {
        e[e.JoinedConversation = 0] = "JoinedConversation",
        e[e.LeftConversation = 1] = "LeftConversation",
        e[e.Updated = 2] = "Updated"
    }(t.ParticipantChangedReason || (t.ParticipantChangedReason = {}))
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
      , i = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SynthesisRequest = t.SpeechSynthesizer = void 0;
    var o = r(53)
      , s = r(4)
      , a = r(64)
      , c = r(74)
      , u = r(73)
      , p = r(63)
      , l = r(61)
      , f = function() {
        function e(e, t) {
            var r = e;
            p.Contracts.throwIfNull(r, "speechConfig"),
            null !== t && (this.audioConfig = void 0 === t ? "undefined" == typeof window ? void 0 : l.AudioConfig.fromDefaultSpeakerOutput() : t),
            this.privProperties = r.properties.clone(),
            this.privDisposed = !1,
            this.privSynthesizing = !1,
            this.privConnectionFactory = new o.SpeechSynthesisConnectionFactory,
            this.synthesisRequestQueue = new s.Queue,
            this.implCommonSynthesizeSetup()
        }
        return Object.defineProperty(e.prototype, "authorizationToken", {
            get: function() {
                return this.properties.getProperty(l.PropertyId.SpeechServiceAuthorization_Token)
            },
            set: function(e) {
                p.Contracts.throwIfNullOrWhitespace(e, "token"),
                this.properties.setProperty(l.PropertyId.SpeechServiceAuthorization_Token, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "autoDetectSourceLanguage", {
            get: function() {
                return this.properties.getProperty(l.PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages) === o.AutoDetectSourceLanguagesOpenRangeOptionName
            },
            enumerable: !1,
            configurable: !0
        }),
        e.FromConfig = function(t, r, n) {
            var i = t;
            return r.properties.mergeTo(i.properties),
            new e(t,n)
        }
        ,
        e.prototype.buildSsml = function(t) {
            var r, n = ((r = {})["af-ZA"] = "af-ZA-AdriNeural",
            r["am-ET"] = "am-ET-AmehaNeural",
            r["ar-AE"] = "ar-AE-FatimaNeural",
            r["ar-BH"] = "ar-BH-AliNeural",
            r["ar-DZ"] = "ar-DZ-AminaNeural",
            r["ar-EG"] = "ar-EG-SalmaNeural",
            r["ar-IQ"] = "ar-IQ-BasselNeural",
            r["ar-JO"] = "ar-JO-SanaNeural",
            r["ar-KW"] = "ar-KW-FahedNeural",
            r["ar-LY"] = "ar-LY-ImanNeural",
            r["ar-MA"] = "ar-MA-JamalNeural",
            r["ar-QA"] = "ar-QA-AmalNeural",
            r["ar-SA"] = "ar-SA-HamedNeural",
            r["ar-SY"] = "ar-SY-AmanyNeural",
            r["ar-TN"] = "ar-TN-HediNeural",
            r["ar-YE"] = "ar-YE-MaryamNeural",
            r["bg-BG"] = "bg-BG-BorislavNeural",
            r["bn-BD"] = "bn-BD-NabanitaNeural",
            r["ca-ES"] = "ca-ES-JoanaNeural",
            r["cs-CZ"] = "cs-CZ-AntoninNeural",
            r["cy-GB"] = "cy-GB-AledNeural",
            r["da-DK"] = "da-DK-ChristelNeural",
            r["de-AT"] = "de-AT-IngridNeural",
            r["de-CH"] = "de-CH-JanNeural",
            r["de-DE"] = "de-DE-KatjaNeural",
            r["el-GR"] = "el-GR-AthinaNeural",
            r["en-AU"] = "en-AU-NatashaNeural",
            r["en-CA"] = "en-CA-ClaraNeural",
            r["en-GB"] = "en-GB-LibbyNeural",
            r["en-HK"] = "en-HK-SamNeural",
            r["en-IE"] = "en-IE-ConnorNeural",
            r["en-IN"] = "en-IN-NeerjaNeural",
            r["en-KE"] = "en-KE-AsiliaNeural",
            r["en-NG"] = "en-NG-AbeoNeural",
            r["en-NZ"] = "en-NZ-MitchellNeural",
            r["en-PH"] = "en-PH-JamesNeural",
            r["en-SG"] = "en-SG-LunaNeural",
            r["en-TZ"] = "en-TZ-ElimuNeural",
            r["en-US"] = "en-US-JennyNeural",
            r["en-ZA"] = "en-ZA-LeahNeural",
            r["es-AR"] = "es-AR-ElenaNeural",
            r["es-BO"] = "es-BO-MarceloNeural",
            r["es-CL"] = "es-CL-CatalinaNeural",
            r["es-CO"] = "es-CO-GonzaloNeural",
            r["es-CR"] = "es-CR-JuanNeural",
            r["es-CU"] = "es-CU-BelkysNeural",
            r["es-DO"] = "es-DO-EmilioNeural",
            r["es-EC"] = "es-EC-AndreaNeural",
            r["es-ES"] = "es-ES-AlvaroNeural",
            r["es-GQ"] = "es-GQ-JavierNeural",
            r["es-GT"] = "es-GT-AndresNeural",
            r["es-HN"] = "es-HN-CarlosNeural",
            r["es-MX"] = "es-MX-DaliaNeural",
            r["es-NI"] = "es-NI-FedericoNeural",
            r["es-PA"] = "es-PA-MargaritaNeural",
            r["es-PE"] = "es-PE-AlexNeural",
            r["es-PR"] = "es-PR-KarinaNeural",
            r["es-PY"] = "es-PY-MarioNeural",
            r["es-SV"] = "es-SV-LorenaNeural",
            r["es-US"] = "es-US-AlonsoNeural",
            r["es-UY"] = "es-UY-MateoNeural",
            r["es-VE"] = "es-VE-PaolaNeural",
            r["et-EE"] = "et-EE-AnuNeural",
            r["fa-IR"] = "fa-IR-DilaraNeural",
            r["fi-FI"] = "fi-FI-SelmaNeural",
            r["fil-PH"] = "fil-PH-AngeloNeural",
            r["fr-BE"] = "fr-BE-CharlineNeural",
            r["fr-CA"] = "fr-CA-SylvieNeural",
            r["fr-CH"] = "fr-CH-ArianeNeural",
            r["fr-FR"] = "fr-FR-DeniseNeural",
            r["ga-IE"] = "ga-IE-ColmNeural",
            r["gl-ES"] = "gl-ES-RoiNeural",
            r["gu-IN"] = "gu-IN-DhwaniNeural",
            r["he-IL"] = "he-IL-AvriNeural",
            r["hi-IN"] = "hi-IN-MadhurNeural",
            r["hr-HR"] = "hr-HR-GabrijelaNeural",
            r["hu-HU"] = "hu-HU-NoemiNeural",
            r["id-ID"] = "id-ID-ArdiNeural",
            r["it-IT"] = "it-IT-IsabellaNeural",
            r["ja-JP"] = "ja-JP-NanamiNeural",
            r["jv-ID"] = "jv-ID-DimasNeural",
            r["km-KH"] = "km-KH-PisethNeural",
            r["ko-KR"] = "ko-KR-SunHiNeural",
            r["lt-LT"] = "lt-LT-LeonasNeural",
            r["lv-LV"] = "lv-LV-EveritaNeural",
            r["mr-IN"] = "mr-IN-AarohiNeural",
            r["ms-MY"] = "ms-MY-OsmanNeural",
            r["mt-MT"] = "mt-MT-GraceNeural",
            r["my-MM"] = "my-MM-NilarNeural",
            r["nb-NO"] = "nb-NO-PernilleNeural",
            r["nl-BE"] = "nl-BE-ArnaudNeural",
            r["nl-NL"] = "nl-NL-ColetteNeural",
            r["pl-PL"] = "pl-PL-AgnieszkaNeural",
            r["pt-BR"] = "pt-BR-FranciscaNeural",
            r["pt-PT"] = "pt-PT-DuarteNeural",
            r["ro-RO"] = "ro-RO-AlinaNeural",
            r["ru-RU"] = "ru-RU-SvetlanaNeural",
            r["sk-SK"] = "sk-SK-LukasNeural",
            r["sl-SI"] = "sl-SI-PetraNeural",
            r["so-SO"] = "so-SO-MuuseNeural",
            r["su-ID"] = "su-ID-JajangNeural",
            r["sv-SE"] = "sv-SE-SofieNeural",
            r["sw-KE"] = "sw-KE-RafikiNeural",
            r["sw-TZ"] = "sw-TZ-DaudiNeural",
            r["ta-IN"] = "ta-IN-PallaviNeural",
            r["ta-LK"] = "ta-LK-KumarNeural",
            r["ta-SG"] = "ta-SG-AnbuNeural",
            r["te-IN"] = "te-IN-MohanNeural",
            r["th-TH"] = "th-TH-PremwadeeNeural",
            r["tr-TR"] = "tr-TR-AhmetNeural",
            r["uk-UA"] = "uk-UA-OstapNeural",
            r["ur-IN"] = "ur-IN-GulNeural",
            r["ur-PK"] = "ur-PK-AsadNeural",
            r["uz-UZ"] = "uz-UZ-MadinaNeural",
            r["vi-VN"] = "vi-VN-HoaiMyNeural",
            r["zh-CN"] = "zh-CN-XiaoxiaoNeural",
            r["zh-HK"] = "zh-HK-HiuMaanNeural",
            r["zh-TW"] = "zh-TW-HsiaoChenNeural",
            r["zu-ZA"] = "zu-ZA-ThandoNeural",
            r), i = this.properties.getProperty(l.PropertyId.SpeechServiceConnection_SynthLanguage, "en-US"), o = this.properties.getProperty(l.PropertyId.SpeechServiceConnection_SynthVoice, ""), s = e.XMLEncode(t);
            return this.autoDetectSourceLanguage ? i = "en-US" : o = o || n[i],
            o && (s = "<voice name='" + o + "'>" + s + "</voice>"),
            s = "<speak version='1.0' xmlns='http://www.w3.org/2001/10/synthesis' xmlns:mstts='http://www.w3.org/2001/mstts' xmlns:emo='http://www.w3.org/2009/10/emotionml' xml:lang='" + i + "'>" + s + "</speak>"
        }
        ,
        e.prototype.speakTextAsync = function(e, t, r, n) {
            this.speakImpl(e, !1, t, r, n)
        }
        ,
        e.prototype.speakSsmlAsync = function(e, t, r, n) {
            this.speakImpl(e, !0, t, r, n)
        }
        ,
        e.prototype.close = function(e, t) {
            p.Contracts.throwIfDisposed(this.privDisposed),
            s.marshalPromiseToCallbacks(this.dispose(!0), e, t)
        }
        ,
        Object.defineProperty(e.prototype, "internalData", {
            get: function() {
                return this.privAdapter
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.dispose = function(e) {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return this.privDisposed ? [2] : e && this.privAdapter ? [4, this.privAdapter.dispose()] : [3, 2];
                    case 1:
                        t.sent(),
                        t.label = 2;
                    case 2:
                        return this.privDisposed = !0,
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.createSynthesizerConfig = function(e) {
            return new o.SynthesizerConfig(e,this.privProperties)
        }
        ,
        e.prototype.createSynthesisAdapter = function(e, t, r, n) {
            return new o.SynthesisAdapterBase(e,t,n,this,this.audioConfig)
        }
        ,
        e.prototype.implCommonSynthesizeSetup = function() {
            var e = this
              , t = "undefined" != typeof window ? "Browser" : "Node"
              , r = "unknown"
              , n = "unknown";
            "undefined" != typeof navigator && (t = t + "/" + navigator.platform,
            r = navigator.userAgent,
            n = navigator.appVersion);
            var i = this.createSynthesizerConfig(new o.SpeechServiceConfig(new o.Context(new o.OS(t,r,n))))
              , s = this.privProperties.getProperty(l.PropertyId.SpeechServiceConnection_Key, void 0)
              , a = s && "" !== s ? new o.CognitiveSubscriptionKeyAuthentication(s) : new o.CognitiveTokenAuthentication((function(t) {
                var r = e.privProperties.getProperty(l.PropertyId.SpeechServiceAuthorization_Token, void 0);
                return Promise.resolve(r)
            }
            ),(function(t) {
                var r = e.privProperties.getProperty(l.PropertyId.SpeechServiceAuthorization_Token, void 0);
                return Promise.resolve(r)
            }
            ));
            this.privAdapter = this.createSynthesisAdapter(a, this.privConnectionFactory, this.audioConfig, i),
            this.privAdapter.audioOutputFormat = c.AudioOutputFormatImpl.fromSpeechSynthesisOutputFormat(l.SpeechSynthesisOutputFormat[this.properties.getProperty(l.PropertyId.SpeechServiceConnection_SynthOutputFormat, void 0)])
        }
        ,
        e.prototype.speakImpl = function(e, t, r, n, i) {
            var o = this;
            try {
                p.Contracts.throwIfDisposed(this.privDisposed);
                var c = s.createNoDashGuid()
                  , f = void 0;
                f = i instanceof l.PushAudioOutputStreamCallback ? new u.PushAudioOutputStreamImpl(i) : i instanceof l.PullAudioOutputStream ? i : void 0 !== i ? new a.AudioFileWriter(i) : void 0,
                this.synthesisRequestQueue.enqueue(new h(c,e,t,(function(e) {
                    if (o.privSynthesizing = !1,
                    r)
                        try {
                            r(e)
                        } catch (e) {
                            n && n(e)
                        }
                    r = void 0,
                    o.adapterSpeak().catch((function() {}
                    ))
                }
                ),(function(e) {
                    n && n(e)
                }
                ),f)),
                this.adapterSpeak().catch((function() {}
                ))
            } catch (e) {
                if (n)
                    if (e instanceof Error) {
                        var v = e;
                        n(v.name + ": " + v.message)
                    } else
                        n(e);
                this.dispose(!0).catch((function() {}
                ))
            }
        }
        ,
        e.prototype.adapterSpeak = function() {
            return n(this, void 0, void 0, (function() {
                var e;
                return i(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return this.privDisposed || this.privSynthesizing ? [3, 2] : (this.privSynthesizing = !0,
                        [4, this.synthesisRequestQueue.dequeue()]);
                    case 1:
                        return e = t.sent(),
                        [2, this.privAdapter.Speak(e.text, e.isSSML, e.requestId, e.cb, e.err, e.dataStream)];
                    case 2:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.XMLEncode = function(e) {
            return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;")
        }
        ,
        e
    }();
    t.SpeechSynthesizer = f;
    var h = function(e, t, r, n, i, o) {
        this.requestId = e,
        this.text = t,
        this.isSSML = r,
        this.cb = n,
        this.err = i,
        this.dataStream = o
    };
    t.SynthesisRequest = h
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeechSynthesisResult = void 0;
    var n = function() {
        function e(e, t, r, n, i) {
            this.privResultId = e,
            this.privReason = t,
            this.privAudioData = r,
            this.privErrorDetails = n,
            this.privProperties = i
        }
        return Object.defineProperty(e.prototype, "resultId", {
            get: function() {
                return this.privResultId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "reason", {
            get: function() {
                return this.privReason
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "audioData", {
            get: function() {
                return this.privAudioData
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "errorDetails", {
            get: function() {
                return this.privErrorDetails
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.SpeechSynthesisResult = n
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeechSynthesisEventArgs = void 0;
    var n = function() {
        function e(e) {
            this.privResult = e
        }
        return Object.defineProperty(e.prototype, "result", {
            get: function() {
                return this.privResult
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.SpeechSynthesisEventArgs = n
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeechSynthesisWordBoundaryEventArgs = void 0;
    var n = function() {
        function e(e, t, r, n) {
            this.privAudioOffset = e,
            this.privText = t,
            this.privWordLength = r,
            this.privTextOffset = n
        }
        return Object.defineProperty(e.prototype, "audioOffset", {
            get: function() {
                return this.privAudioOffset
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "text", {
            get: function() {
                return this.privText
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "wordLength", {
            get: function() {
                return this.privWordLength
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "textOffset", {
            get: function() {
                return this.privTextOffset
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.SpeechSynthesisWordBoundaryEventArgs = n
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeechSynthesisBookmarkEventArgs = void 0;
    var n = function() {
        function e(e, t) {
            this.privAudioOffset = e,
            this.privText = t
        }
        return Object.defineProperty(e.prototype, "audioOffset", {
            get: function() {
                return this.privAudioOffset
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "text", {
            get: function() {
                return this.privText
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.SpeechSynthesisBookmarkEventArgs = n
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeechSynthesisVisemeEventArgs = void 0;
    var n = function() {
        function e(e, t, r) {
            this.privAudioOffset = e,
            this.privVisemeId = t,
            this.privAnimation = r
        }
        return Object.defineProperty(e.prototype, "audioOffset", {
            get: function() {
                return this.privAudioOffset
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "visemeId", {
            get: function() {
                return this.privVisemeId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "animation", {
            get: function() {
                return this.privAnimation
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.SpeechSynthesisVisemeEventArgs = n
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
    , o = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeakerAudioDestination = void 0;
    var s = r(53)
      , a = r(4)
      , c = r(73)
      , u = r(72)
      , p = ((n = {})[u.AudioFormatTag.PCM] = "audio/wav",
    n[u.AudioFormatTag.MuLaw] = "audio/x-wav",
    n[u.AudioFormatTag.MP3] = "audio/mpeg",
    n[u.AudioFormatTag.OGG_OPUS] = "audio/ogg",
    n[u.AudioFormatTag.WEBM_OPUS] = "audio/webm; codecs=opus",
    n[u.AudioFormatTag.ALaw] = "audio/x-wav",
    n[u.AudioFormatTag.FLAC] = "audio/flac",
    n)
      , l = function() {
        function e(e) {
            this.privPlaybackStarted = !1,
            this.privAppendingToBuffer = !1,
            this.privMediaSourceOpened = !1,
            this.privBytesReceived = 0,
            this.privId = e || a.createNoDashGuid(),
            this.privIsPaused = !1,
            this.privIsClosed = !1
        }
        return e.prototype.id = function() {
            return this.privId
        }
        ,
        e.prototype.write = function(e, t, r) {
            void 0 !== this.privAudioBuffer ? (this.privAudioBuffer.push(e),
            this.updateSourceBuffer().then((function() {
                t && t()
            }
            ), (function(e) {
                r && r(e)
            }
            ))) : void 0 !== this.privAudioOutputStream && (this.privAudioOutputStream.write(e),
            this.privBytesReceived += e.byteLength)
        }
        ,
        e.prototype.close = function(e, t) {
            var r = this;
            if (this.privIsClosed = !0,
            void 0 !== this.privSourceBuffer)
                this.handleSourceBufferUpdateEnd().then((function() {
                    e && e()
                }
                ), (function(e) {
                    t && t(e)
                }
                ));
            else if (void 0 !== this.privAudioOutputStream)
                if (this.privFormat.formatTag !== u.AudioFormatTag.PCM && this.privFormat.formatTag !== u.AudioFormatTag.MuLaw && this.privFormat.formatTag !== u.AudioFormatTag.ALaw || !1 !== this.privFormat.hasHeader) {
                    var n = new ArrayBuffer(this.privBytesReceived);
                    this.privAudioOutputStream.read(n).then((function(i) {
                        n = s.SynthesisAdapterBase.addHeader(n, r.privFormat);
                        var o = new Blob([n],{
                            type: p[r.privFormat.formatTag]
                        });
                        r.privAudio.src = window.URL.createObjectURL(o),
                        r.notifyPlayback().then((function() {
                            e && e()
                        }
                        ), (function(e) {
                            t && t(e)
                        }
                        ))
                    }
                    ), (function(e) {
                        t && t(e)
                    }
                    ))
                } else
                    console.warn("Play back is not supported for raw PCM, mulaw or alaw format without header."),
                    this.onAudioEnd && this.onAudioEnd(this);
            else
                this.onAudioEnd && this.onAudioEnd(this)
        }
        ,
        Object.defineProperty(e.prototype, "format", {
            set: function(e) {
                var t = this;
                if ("undefined" != typeof AudioContext || void 0 !== window.webkitAudioContext) {
                    this.privFormat = e;
                    var r = p[this.privFormat.formatTag];
                    void 0 === r ? console.warn("Unknown mimeType for format " + u.AudioFormatTag[this.privFormat.formatTag] + "; playback is not supported.") : "undefined" != typeof MediaSource && MediaSource.isTypeSupported(r) ? (this.privAudio = new Audio,
                    this.privAudioBuffer = [],
                    this.privMediaSource = new MediaSource,
                    this.privAudio.src = URL.createObjectURL(this.privMediaSource),
                    this.privAudio.load(),
                    this.privMediaSource.onsourceopen = function(e) {
                        t.privMediaSourceOpened = !0,
                        t.privMediaSource.duration = 1800,
                        t.privSourceBuffer = t.privMediaSource.addSourceBuffer(r),
                        t.privSourceBuffer.onupdate = function(e) {
                            t.updateSourceBuffer().catch((function(e) {
                                a.Events.instance.onEvent(new a.BackgroundEvent(e))
                            }
                            ))
                        }
                        ,
                        t.privSourceBuffer.onupdateend = function(e) {
                            t.handleSourceBufferUpdateEnd().catch((function(e) {
                                a.Events.instance.onEvent(new a.BackgroundEvent(e))
                            }
                            ))
                        }
                        ,
                        t.privSourceBuffer.onupdatestart = function(e) {
                            t.privAppendingToBuffer = !1
                        }
                    }
                    ,
                    this.updateSourceBuffer().catch((function(e) {
                        a.Events.instance.onEvent(new a.BackgroundEvent(e))
                    }
                    ))) : (console.warn("Format " + u.AudioFormatTag[this.privFormat.formatTag] + " could not be played by MSE, streaming playback is not enabled."),
                    this.privAudioOutputStream = new c.PullAudioOutputStreamImpl,
                    this.privAudioOutputStream.format = this.privFormat,
                    this.privAudio = new Audio)
                }
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "isClosed", {
            get: function() {
                return this.privIsClosed
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "currentTime", {
            get: function() {
                return void 0 !== this.privAudio ? this.privAudio.currentTime : -1
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.pause = function() {
            this.privIsPaused || void 0 === this.privAudio || (this.privAudio.pause(),
            this.privIsPaused = !0)
        }
        ,
        e.prototype.resume = function(e, t) {
            this.privIsPaused && void 0 !== this.privAudio && (this.privAudio.play().then((function() {
                e && e()
            }
            ), (function(e) {
                t && t(e)
            }
            )),
            this.privIsPaused = !1)
        }
        ,
        Object.defineProperty(e.prototype, "internalAudio", {
            get: function() {
                return this.privAudio
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.updateSourceBuffer = function() {
            return i(this, void 0, void 0, (function() {
                var e;
                return o(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        if (!(void 0 !== this.privAudioBuffer && this.privAudioBuffer.length > 0 && this.sourceBufferAvailable()))
                            return [3, 2];
                        this.privAppendingToBuffer = !0,
                        e = this.privAudioBuffer.shift();
                        try {
                            this.privSourceBuffer.appendBuffer(e)
                        } catch (t) {
                            return this.privAudioBuffer.unshift(e),
                            console.log("buffer filled, pausing addition of binaries until space is made"),
                            [2]
                        }
                        return [4, this.notifyPlayback()];
                    case 1:
                        return t.sent(),
                        [3, 4];
                    case 2:
                        return this.canEndStream() ? [4, this.handleSourceBufferUpdateEnd()] : [3, 4];
                    case 3:
                        t.sent(),
                        t.label = 4;
                    case 4:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.handleSourceBufferUpdateEnd = function() {
            return i(this, void 0, void 0, (function() {
                return o(this, (function(e) {
                    switch (e.label) {
                    case 0:
                        return this.canEndStream() && this.sourceBufferAvailable() ? (this.privMediaSource.endOfStream(),
                        [4, this.notifyPlayback()]) : [3, 2];
                    case 1:
                        e.sent(),
                        e.label = 2;
                    case 2:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.notifyPlayback = function() {
            return i(this, void 0, void 0, (function() {
                var e = this;
                return o(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return this.privPlaybackStarted || void 0 === this.privAudio ? [3, 2] : (this.privPlaybackStarted = !0,
                        this.onAudioStart && this.onAudioStart(this),
                        this.privAudio.onended = function() {
                            e.onAudioEnd && e.onAudioEnd(e)
                        }
                        ,
                        this.privIsPaused ? [3, 2] : [4, this.privAudio.play()]);
                    case 1:
                        t.sent(),
                        t.label = 2;
                    case 2:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.canEndStream = function() {
            return this.isClosed && void 0 !== this.privSourceBuffer && 0 === this.privAudioBuffer.length && this.privMediaSourceOpened && !this.privAppendingToBuffer && "open" === this.privMediaSource.readyState
        }
        ,
        e.prototype.sourceBufferAvailable = function() {
            return void 0 !== this.privSourceBuffer && !this.privSourceBuffer.updating
        }
        ,
        e
    }();
    t.SpeakerAudioDestination = l
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConversationTranscriptionCanceledEventArgs = void 0;
    var o = function(e) {
        function t() {
            return null !== e && e.apply(this, arguments) || this
        }
        return i(t, e),
        t
    }(r(90).CancellationEventArgsBase);
    t.ConversationTranscriptionCanceledEventArgs = o
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.PronunciationAssessmentGradingSystem = void 0,
    function(e) {
        e[e.FivePoint = 1] = "FivePoint",
        e[e.HundredMark = 2] = "HundredMark"
    }(t.PronunciationAssessmentGradingSystem || (t.PronunciationAssessmentGradingSystem = {}))
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.PronunciationAssessmentGranularity = void 0,
    function(e) {
        e[e.Phoneme = 1] = "Phoneme",
        e[e.Word = 2] = "Word",
        e[e.FullText = 3] = "FullText"
    }(t.PronunciationAssessmentGranularity || (t.PronunciationAssessmentGranularity = {}))
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.PronunciationAssessmentConfig = void 0;
    var n = r(63)
      , i = r(61)
      , o = function() {
        function e(e, t, r, o) {
            void 0 === t && (t = i.PronunciationAssessmentGradingSystem.FivePoint),
            void 0 === r && (r = i.PronunciationAssessmentGranularity.Phoneme),
            void 0 === o && (o = !1),
            n.Contracts.throwIfNullOrUndefined(e, "referenceText"),
            this.privProperties = new i.PropertyCollection,
            this.privProperties.setProperty(i.PropertyId.PronunciationAssessment_ReferenceText, e),
            this.privProperties.setProperty(i.PropertyId.PronunciationAssessment_GradingSystem, i.PronunciationAssessmentGradingSystem[t]),
            this.privProperties.setProperty(i.PropertyId.PronunciationAssessment_Granularity, i.PronunciationAssessmentGranularity[r]),
            this.privProperties.setProperty(i.PropertyId.PronunciationAssessment_EnableMiscue, String(o))
        }
        return e.fromJSON = function(t) {
            n.Contracts.throwIfNullOrUndefined(t, "json");
            var r = new e("");
            return r.privProperties = new i.PropertyCollection,
            r.properties.setProperty(i.PropertyId.PronunciationAssessment_Json, t),
            r
        }
        ,
        e.prototype.toJSON = function() {
            return this.updateJson(),
            this.privProperties.getProperty(i.PropertyId.PronunciationAssessment_Params)
        }
        ,
        e.prototype.applyTo = function(e) {
            this.updateJson(),
            e.internalData.speechContext.setPronunciationAssessmentParams(this.properties.getProperty(i.PropertyId.PronunciationAssessment_Params))
        }
        ,
        Object.defineProperty(e.prototype, "referenceText", {
            get: function() {
                return this.properties.getProperty(i.PropertyId.PronunciationAssessment_ReferenceText)
            },
            set: function(e) {
                n.Contracts.throwIfNullOrWhitespace(e, "referenceText"),
                this.properties.setProperty(i.PropertyId.PronunciationAssessment_ReferenceText, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.updateJson = function() {
            var e = this.privProperties.getProperty(i.PropertyId.PronunciationAssessment_Json, "{}")
              , t = JSON.parse(e)
              , r = this.privProperties.getProperty(i.PropertyId.PronunciationAssessment_ReferenceText);
            r && (t.referenceText = r);
            var n = this.privProperties.getProperty(i.PropertyId.PronunciationAssessment_GradingSystem);
            n && (t.gradingSystem = n);
            var o = this.privProperties.getProperty(i.PropertyId.PronunciationAssessment_Granularity);
            o && (t.granularity = o),
            t.dimension = "Comprehensive";
            var s = this.privProperties.getProperty(i.PropertyId.PronunciationAssessment_EnableMiscue);
            "true" === s ? t.enableMiscue = !0 : "false" === s && (t.enableMiscue = !1),
            this.privProperties.setProperty(i.PropertyId.PronunciationAssessment_Params, JSON.stringify(t))
        }
        ,
        e
    }();
    t.PronunciationAssessmentConfig = o
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.PronunciationAssessmentResult = void 0;
    var n = r(63)
      , i = r(61)
      , o = function() {
        function e(e) {
            var t = JSON.parse(e);
            n.Contracts.throwIfNullOrUndefined(t.NBest[0], "NBest"),
            this.privPronJson = t.NBest[0]
        }
        return e.fromResult = function(t) {
            n.Contracts.throwIfNullOrUndefined(t, "result");
            var r = t.properties.getProperty(i.PropertyId.SpeechServiceResponse_JsonResult);
            return n.Contracts.throwIfNullOrUndefined(r, "json"),
            new e(r)
        }
        ,
        Object.defineProperty(e.prototype, "detailResult", {
            get: function() {
                return this.privPronJson
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "accuracyScore", {
            get: function() {
                return this.detailResult.PronunciationAssessment.AccuracyScore
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "pronunciationScore", {
            get: function() {
                return this.detailResult.PronunciationAssessment.PronScore
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "completenessScore", {
            get: function() {
                return this.detailResult.PronunciationAssessment.CompletenessScore
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "fluencyScore", {
            get: function() {
                return this.detailResult.PronunciationAssessment.FluencyScore
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.PronunciationAssessmentResult = o
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.RecognitionEndedEvent = t.RecognitionCompletionStatus = t.RecognitionStartedEvent = t.ConnectingToServiceEvent = t.ListeningStartedEvent = t.RecognitionTriggeredEvent = t.SpeechRecognitionEvent = void 0;
    var o = r(4)
      , s = function(e) {
        function t(t, r, n, i) {
            void 0 === i && (i = o.EventType.Info);
            var s = e.call(this, t, i) || this;
            return s.privRequestId = r,
            s.privSessionId = n,
            s
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "requestId", {
            get: function() {
                return this.privRequestId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "sessionId", {
            get: function() {
                return this.privSessionId
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(o.PlatformEvent);
    t.SpeechRecognitionEvent = s;
    var a = function(e) {
        function t(t, r, n, i) {
            var o = e.call(this, "RecognitionTriggeredEvent", t, r) || this;
            return o.privAudioSourceId = n,
            o.privAudioNodeId = i,
            o
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "audioSourceId", {
            get: function() {
                return this.privAudioSourceId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "audioNodeId", {
            get: function() {
                return this.privAudioNodeId
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(s);
    t.RecognitionTriggeredEvent = a;
    var c = function(e) {
        function t(t, r, n, i) {
            var o = e.call(this, "ListeningStartedEvent", t, r) || this;
            return o.privAudioSourceId = n,
            o.privAudioNodeId = i,
            o
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "audioSourceId", {
            get: function() {
                return this.privAudioSourceId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "audioNodeId", {
            get: function() {
                return this.privAudioNodeId
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(s);
    t.ListeningStartedEvent = c;
    var u = function(e) {
        function t(t, r, n) {
            var i = e.call(this, "ConnectingToServiceEvent", t, n) || this;
            return i.privAuthFetchEventid = r,
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "authFetchEventid", {
            get: function() {
                return this.privAuthFetchEventid
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(s);
    t.ConnectingToServiceEvent = u;
    var p, l = function(e) {
        function t(t, r, n, i, o) {
            var s = e.call(this, "RecognitionStartedEvent", t, o) || this;
            return s.privAudioSourceId = r,
            s.privAudioNodeId = n,
            s.privAuthFetchEventId = i,
            s
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "audioSourceId", {
            get: function() {
                return this.privAudioSourceId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "audioNodeId", {
            get: function() {
                return this.privAudioNodeId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "authFetchEventId", {
            get: function() {
                return this.privAuthFetchEventId
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(s);
    t.RecognitionStartedEvent = l,
    function(e) {
        e[e.Success = 0] = "Success",
        e[e.AudioSourceError = 1] = "AudioSourceError",
        e[e.AudioSourceTimeout = 2] = "AudioSourceTimeout",
        e[e.AuthTokenFetchError = 3] = "AuthTokenFetchError",
        e[e.AuthTokenFetchTimeout = 4] = "AuthTokenFetchTimeout",
        e[e.UnAuthorized = 5] = "UnAuthorized",
        e[e.ConnectTimeout = 6] = "ConnectTimeout",
        e[e.ConnectError = 7] = "ConnectError",
        e[e.ClientRecognitionActivityTimeout = 8] = "ClientRecognitionActivityTimeout",
        e[e.UnknownError = 9] = "UnknownError"
    }(p = t.RecognitionCompletionStatus || (t.RecognitionCompletionStatus = {}));
    var f = function(e) {
        function t(t, r, n, i, s, a, c, u) {
            var l = e.call(this, "RecognitionEndedEvent", t, s, c === p.Success ? o.EventType.Info : o.EventType.Error) || this;
            return l.privAudioSourceId = r,
            l.privAudioNodeId = n,
            l.privAuthFetchEventId = i,
            l.privStatus = c,
            l.privError = u,
            l.privServiceTag = a,
            l
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "audioSourceId", {
            get: function() {
                return this.privAudioSourceId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "audioNodeId", {
            get: function() {
                return this.privAudioNodeId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "authFetchEventId", {
            get: function() {
                return this.privAuthFetchEventId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "serviceTag", {
            get: function() {
                return this.privServiceTag
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "status", {
            get: function() {
                return this.privStatus
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "error", {
            get: function() {
                return this.privError
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(s);
    t.RecognitionEndedEvent = f
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
      , i = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ServiceRecognizerBase = void 0;
    var o = r(2)
      , s = r(4)
      , a = r(61)
      , c = r(53)
      , u = r(170)
      , p = function() {
        function e(t, r, o, p, l) {
            var f = this;
            if (this.privSetTimeout = setTimeout,
            this.privIsLiveAudio = !1,
            this.recognizeOverride = void 0,
            this.disconnectOverride = void 0,
            this.receiveMessageOverride = void 0,
            this.sendSpeechContext = function(e) {
                var t = f.speechContext.toJSON();
                if (f.privRequestSession.onSpeechContext(),
                t)
                    return e.send(new u.SpeechConnectionMessage(s.MessageType.Text,"speech.context",f.privRequestSession.requestId,"application/json",t))
            }
            ,
            this.sendPrePayloadJSONOverride = void 0,
            this.postConnectImplOverride = void 0,
            this.configConnectionOverride = void 0,
            this.sendSpeechServiceConfig = function(t, r, n) {
                if (!0 !== e.telemetryDataEnabled) {
                    var i = {
                        context: {
                            system: JSON.parse(n).context.system
                        }
                    };
                    n = JSON.stringify(i)
                }
                if ("true" === f.privRecognizerConfig.parameters.getProperty("TranscriptionService_SingleChannel", "false").toLowerCase()) {
                    var o = JSON.parse(n);
                    o.context.DisableReferenceChannel = "True",
                    o.context.MicSpec = "1_0_0",
                    n = JSON.stringify(o)
                }
                if (n)
                    return t.send(new u.SpeechConnectionMessage(s.MessageType.Text,"speech.config",r.requestId,"application/json",n))
            }
            ,
            !t)
                throw new s.ArgumentNullError("authentication");
            if (!r)
                throw new s.ArgumentNullError("connectionFactory");
            if (!o)
                throw new s.ArgumentNullError("audioSource");
            if (!p)
                throw new s.ArgumentNullError("recognizerConfig");
            this.privMustReportEndOfStream = !1,
            this.privAuthentication = t,
            this.privConnectionFactory = r,
            this.privAudioSource = o,
            this.privRecognizerConfig = p,
            this.privIsDisposed = !1,
            this.privRecognizer = l,
            this.privRequestSession = new c.RequestSession(this.privAudioSource.id()),
            this.privConnectionEvents = new s.EventSource,
            this.privServiceEvents = new s.EventSource,
            this.privDynamicGrammar = new c.DynamicGrammarBuilder,
            this.privSpeechContext = new c.SpeechContext(this.privDynamicGrammar),
            this.privAgentConfig = new c.AgentConfig,
            "undefined" != typeof Blob && "undefined" != typeof Worker && (this.privSetTimeout = s.Timeout.setTimeout),
            this.connectionEvents.attach((function(e) {
                return n(f, void 0, void 0, (function() {
                    var t;
                    return i(this, (function(r) {
                        switch (r.label) {
                        case 0:
                            return "ConnectionClosedEvent" !== e.name ? [3, 2] : 1003 === (t = e).statusCode || 1007 === t.statusCode || 1002 === t.statusCode || 4e3 === t.statusCode || this.privRequestSession.numConnectionAttempts > this.privRecognizerConfig.maxRetryCount ? [4, this.cancelRecognitionLocal(a.CancellationReason.Error, 1007 === t.statusCode ? a.CancellationErrorCode.BadRequestParameters : a.CancellationErrorCode.ConnectionFailure, t.reason + " websocket error code: " + t.statusCode)] : [3, 2];
                        case 1:
                            r.sent(),
                            r.label = 2;
                        case 2:
                            return [2]
                        }
                    }
                    ))
                }
                ))
            }
            ))
        }
        return Object.defineProperty(e.prototype, "audioSource", {
            get: function() {
                return this.privAudioSource
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "speechContext", {
            get: function() {
                return this.privSpeechContext
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "dynamicGrammar", {
            get: function() {
                return this.privDynamicGrammar
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "agentConfig", {
            get: function() {
                return this.privAgentConfig
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "conversationTranslatorToken", {
            set: function(e) {
                this.privRecognizerConfig.parameters.setProperty(a.PropertyId.ConversationTranslator_Token, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "authentication", {
            set: function(e) {
                this.privAuthentication = this.authentication
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.isDisposed = function() {
            return this.privIsDisposed
        }
        ,
        e.prototype.dispose = function(e) {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        if (this.privIsDisposed = !0,
                        !this.privConnectionConfigurationPromise)
                            return [3, 5];
                        t.label = 1;
                    case 1:
                        return t.trys.push([1, 4, , 5]),
                        [4, this.privConnectionConfigurationPromise];
                    case 2:
                        return [4, t.sent().dispose(e)];
                    case 3:
                        return t.sent(),
                        [3, 5];
                    case 4:
                        return t.sent(),
                        [2];
                    case 5:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        Object.defineProperty(e.prototype, "connectionEvents", {
            get: function() {
                return this.privConnectionEvents
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "serviceEvents", {
            get: function() {
                return this.privServiceEvents
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "recognitionMode", {
            get: function() {
                return this.privRecognizerConfig.recognitionMode
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.recognize = function(e, t, r) {
            return n(this, void 0, void 0, (function() {
                var s, u, p, l, f, h, v, d, y = this;
                return i(this, (function(g) {
                    switch (g.label) {
                    case 0:
                        if (void 0 !== this.recognizeOverride)
                            return [2, this.recognizeOverride(e, t, r)];
                        this.privConnectionConfigurationPromise = null,
                        this.privRecognizerConfig.recognitionMode = e,
                        this.privSuccessCallback = t,
                        this.privErrorCallback = r,
                        this.privRequestSession.startNewRecognition(),
                        this.privRequestSession.listenForServiceTelemetry(this.privAudioSource.events),
                        s = this.connectImpl(),
                        g.label = 1;
                    case 1:
                        return g.trys.push([1, 6, , 8]),
                        [4, this.audioSource.attach(this.privRequestSession.audioNodeId)];
                    case 2:
                        return p = g.sent(),
                        [4, this.audioSource.format];
                    case 3:
                        return l = g.sent(),
                        [4, this.audioSource.deviceInfo];
                    case 4:
                        return f = g.sent(),
                        this.privIsLiveAudio = f.type && f.type === c.type.Microphones,
                        u = new o.ReplayableAudioNode(p,l.avgBytesPerSec),
                        [4, this.privRequestSession.onAudioSourceAttachCompleted(u, !1)];
                    case 5:
                        return g.sent(),
                        this.privRecognizerConfig.SpeechServiceConfig.Context.audio = {
                            source: f
                        },
                        [3, 8];
                    case 6:
                        return h = g.sent(),
                        [4, this.privRequestSession.onStopRecognizing()];
                    case 7:
                        throw g.sent(),
                        h;
                    case 8:
                        return g.trys.push([8, 10, , 12]),
                        [4, s];
                    case 9:
                        return g.sent(),
                        [3, 12];
                    case 10:
                        return v = g.sent(),
                        [4, this.cancelRecognitionLocal(a.CancellationReason.Error, a.CancellationErrorCode.ConnectionFailure, v)];
                    case 11:
                        return g.sent(),
                        [2];
                    case 12:
                        return d = new a.SessionEventArgs(this.privRequestSession.sessionId),
                        this.privRecognizer.sessionStarted && this.privRecognizer.sessionStarted(this.privRecognizer, d),
                        this.receiveMessage(),
                        this.sendAudio(u).catch((function(e) {
                            return n(y, void 0, void 0, (function() {
                                return i(this, (function(t) {
                                    switch (t.label) {
                                    case 0:
                                        return [4, this.cancelRecognitionLocal(a.CancellationReason.Error, a.CancellationErrorCode.RuntimeError, e)];
                                    case 1:
                                        return t.sent(),
                                        [2]
                                    }
                                }
                                ))
                            }
                            ))
                        }
                        )),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.stopRecognizing = function() {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(e) {
                    switch (e.label) {
                    case 0:
                        if (!this.privRequestSession.isRecognizing)
                            return [3, 8];
                        e.label = 1;
                    case 1:
                        return e.trys.push([1, , 6, 8]),
                        [4, this.audioSource.turnOff()];
                    case 2:
                        return e.sent(),
                        [4, this.sendFinalAudio()];
                    case 3:
                        return e.sent(),
                        [4, this.privRequestSession.onStopRecognizing()];
                    case 4:
                        return e.sent(),
                        [4, this.privRequestSession.turnCompletionPromise];
                    case 5:
                        return e.sent(),
                        [3, 8];
                    case 6:
                        return [4, this.privRequestSession.dispose()];
                    case 7:
                        return e.sent(),
                        [7];
                    case 8:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.connect = function() {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(e) {
                    switch (e.label) {
                    case 0:
                        return [4, this.connectImpl()];
                    case 1:
                        return e.sent(),
                        [2, Promise.resolve()]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.connectAsync = function(e, t) {
            this.connectImpl().then((function(r) {
                try {
                    e && e()
                } catch (e) {
                    t && t(e)
                }
            }
            ), (function(e) {
                try {
                    t && t(e)
                } catch (e) {}
            }
            ))
        }
        ,
        e.prototype.disconnect = function() {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(e) {
                    switch (e.label) {
                    case 0:
                        return [4, this.cancelRecognitionLocal(a.CancellationReason.Error, a.CancellationErrorCode.NoError, "Disconnecting")];
                    case 1:
                        return e.sent(),
                        void 0 === this.disconnectOverride ? [3, 3] : [4, this.disconnectOverride()];
                    case 2:
                        e.sent(),
                        e.label = 3;
                    case 3:
                        return e.trys.push([3, 6, , 7]),
                        [4, this.privConnectionPromise];
                    case 4:
                        return [4, e.sent().dispose()];
                    case 5:
                        return e.sent(),
                        [3, 7];
                    case 6:
                        return e.sent(),
                        [3, 7];
                    case 7:
                        return this.privConnectionPromise = null,
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.sendMessage = function(e) {}
        ,
        e.prototype.sendNetworkMessage = function(e, t) {
            return n(this, void 0, void 0, (function() {
                var r, n;
                return i(this, (function(i) {
                    switch (i.label) {
                    case 0:
                        return r = "string" == typeof t ? s.MessageType.Text : s.MessageType.Binary,
                        n = "string" == typeof t ? "application/json" : "",
                        [4, this.fetchConnection()];
                    case 1:
                        return [2, i.sent().send(new u.SpeechConnectionMessage(r,e,this.privRequestSession.requestId,n,t))]
                    }
                }
                ))
            }
            ))
        }
        ,
        Object.defineProperty(e.prototype, "activityTemplate", {
            get: function() {
                return this.privActivityTemplate
            },
            set: function(e) {
                this.privActivityTemplate = e
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.sendTelemetryData = function() {
            return n(this, void 0, void 0, (function() {
                var t;
                return i(this, (function(r) {
                    switch (r.label) {
                    case 0:
                        if (t = this.privRequestSession.getTelemetry(),
                        !0 !== e.telemetryDataEnabled || this.privIsDisposed || null === t)
                            return [2];
                        if (e.telemetryData)
                            try {
                                e.telemetryData(t)
                            } catch (e) {}
                        return [4, this.fetchConnection()];
                    case 1:
                        return [4, r.sent().send(new u.SpeechConnectionMessage(s.MessageType.Text,"telemetry",this.privRequestSession.requestId,"application/json",t))];
                    case 2:
                        return r.sent(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.cancelRecognitionLocal = function(e, t, r) {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(n) {
                    switch (n.label) {
                    case 0:
                        return this.privRequestSession.isRecognizing ? [4, this.privRequestSession.onStopRecognizing()] : [3, 2];
                    case 1:
                        n.sent(),
                        this.cancelRecognition(this.privRequestSession.sessionId, this.privRequestSession.requestId, e, t, r),
                        n.label = 2;
                    case 2:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.receiveMessage = function() {
            return n(this, void 0, void 0, (function() {
                var e, t, r, n, o, p, l, f, h;
                return i(this, (function(i) {
                    switch (i.label) {
                    case 0:
                        return i.trys.push([0, 18, , 19]),
                        this.privIsDisposed ? [2] : [4, this.fetchConnection()];
                    case 1:
                        return [4, (e = i.sent()).read()];
                    case 2:
                        if (t = i.sent(),
                        void 0 !== this.receiveMessageOverride)
                            return [2, this.receiveMessageOverride()];
                        if (!t)
                            return this.privRequestSession.isRecognizing ? [2, this.receiveMessage()] : [2];
                        if (this.privServiceHasSentMessage = !0,
                        (r = u.SpeechConnectionMessage.fromConnectionMessage(t)).requestId.toLowerCase() !== this.privRequestSession.requestId.toLowerCase())
                            return [3, 17];
                        switch (r.path.toLowerCase()) {
                        case "turn.start":
                            return [3, 3];
                        case "speech.startdetected":
                            return [3, 4];
                        case "speech.enddetected":
                            return [3, 5];
                        case "turn.end":
                            return [3, 6]
                        }
                        return [3, 15];
                    case 3:
                        return this.privMustReportEndOfStream = !0,
                        this.privRequestSession.onServiceTurnStartResponse(),
                        [3, 17];
                    case 4:
                        return n = c.SpeechDetected.fromJSON(r.textBody),
                        o = new a.RecognitionEventArgs(n.Offset,this.privRequestSession.sessionId),
                        this.privRecognizer.speechStartDetected && this.privRecognizer.speechStartDetected(this.privRecognizer, o),
                        [3, 17];
                    case 5:
                        return p = void 0,
                        p = r.textBody.length > 0 ? r.textBody : "{ Offset: 0 }",
                        l = c.SpeechDetected.fromJSON(p),
                        this.privRecognizerConfig.isContinuousRecognition && this.privRequestSession.onServiceRecognized(l.Offset + this.privRequestSession.currentTurnAudioOffset),
                        f = new a.RecognitionEventArgs(l.Offset + this.privRequestSession.currentTurnAudioOffset,this.privRequestSession.sessionId),
                        this.privRecognizer.speechEndDetected && this.privRecognizer.speechEndDetected(this.privRecognizer, f),
                        [3, 17];
                    case 6:
                        return [4, this.sendTelemetryData()];
                    case 7:
                        return i.sent(),
                        this.privRequestSession.isSpeechEnded && this.privMustReportEndOfStream ? (this.privMustReportEndOfStream = !1,
                        [4, this.cancelRecognitionLocal(a.CancellationReason.EndOfStream, a.CancellationErrorCode.NoError, void 0)]) : [3, 9];
                    case 8:
                        i.sent(),
                        i.label = 9;
                    case 9:
                        return h = new a.SessionEventArgs(this.privRequestSession.sessionId),
                        [4, this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition)];
                    case 10:
                        return i.sent(),
                        this.privRecognizerConfig.isContinuousRecognition && !this.privRequestSession.isSpeechEnded && this.privRequestSession.isRecognizing ? [3, 11] : (this.privRecognizer.sessionStopped && this.privRecognizer.sessionStopped(this.privRecognizer, h),
                        [2]);
                    case 11:
                        return [4, this.fetchConnection()];
                    case 12:
                        return e = i.sent(),
                        [4, this.sendPrePayloadJSON(e)];
                    case 13:
                        i.sent(),
                        i.label = 14;
                    case 14:
                        return [3, 17];
                    case 15:
                        return [4, this.processTypeSpecificMessages(r)];
                    case 16:
                        i.sent() || this.privServiceEvents && this.serviceEvents.onEvent(new s.ServiceEvent(r.path.toLowerCase(),r.textBody)),
                        i.label = 17;
                    case 17:
                        return [2, this.receiveMessage()];
                    case 18:
                        return i.sent(),
                        [2, null];
                    case 19:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.sendPrePayloadJSON = function(e) {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return void 0 !== this.sendPrePayloadJSONOverride ? [2, this.sendPrePayloadJSONOverride(e)] : [4, this.sendSpeechContext(e)];
                    case 1:
                        return t.sent(),
                        [4, this.sendWaveHeader(e)];
                    case 2:
                        return t.sent(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.sendWaveHeader = function(e) {
            return n(this, void 0, void 0, (function() {
                var t;
                return i(this, (function(r) {
                    switch (r.label) {
                    case 0:
                        return [4, this.audioSource.format];
                    case 1:
                        return t = r.sent(),
                        [2, e.send(new u.SpeechConnectionMessage(s.MessageType.Binary,"audio",this.privRequestSession.requestId,"audio/x-wav",t.header))]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.connectImpl = function() {
            var e = this;
            return this.privConnectionPromise ? this.privConnectionPromise.then((function(t) {
                return t.state() === s.ConnectionState.Disconnected ? (e.privConnectionId = null,
                e.privConnectionPromise = null,
                e.privServiceHasSentMessage = !1,
                e.connectImpl()) : e.privConnectionPromise
            }
            ), (function(t) {
                return e.privConnectionId = null,
                e.privConnectionPromise = null,
                e.privServiceHasSentMessage = !1,
                e.connectImpl()
            }
            )) : (this.privConnectionPromise = this.retryableConnect(),
            this.privConnectionPromise.catch((function() {}
            )),
            void 0 !== this.postConnectImplOverride ? this.postConnectImplOverride(this.privConnectionPromise) : this.privConnectionPromise)
        }
        ,
        e.prototype.fetchConnection = function() {
            return n(this, void 0, void 0, (function() {
                var e = this;
                return i(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return this.privConnectionConfigurationPromise ? [2, this.privConnectionConfigurationPromise.then((function(t) {
                            return t.state() === s.ConnectionState.Disconnected ? (e.privConnectionId = null,
                            e.privConnectionConfigurationPromise = null,
                            e.privServiceHasSentMessage = !1,
                            e.fetchConnection()) : e.privConnectionConfigurationPromise
                        }
                        ), (function(t) {
                            return e.privConnectionId = null,
                            e.privConnectionConfigurationPromise = null,
                            e.privServiceHasSentMessage = !1,
                            e.fetchConnection()
                        }
                        ))] : (this.privConnectionConfigurationPromise = this.configureConnection(),
                        [4, this.privConnectionConfigurationPromise]);
                    case 1:
                        return [2, t.sent()]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.sendAudio = function(e) {
            return n(this, void 0, void 0, (function() {
                var t, r, o, a, c, p, l = this;
                return i(this, (function(f) {
                    switch (f.label) {
                    case 0:
                        return [4, this.audioSource.format];
                    case 1:
                        return t = f.sent(),
                        r = Date.now(),
                        o = this.privRecognizerConfig.parameters.getProperty("SPEECH-TransmitLengthBeforThrottleMs", "5000"),
                        a = t.avgBytesPerSec / 1e3 * parseInt(o, 10),
                        c = this.privRequestSession.recogNumber,
                        [2, (p = function() {
                            return n(l, void 0, void 0, (function() {
                                var n, o, l, f, h = this;
                                return i(this, (function(i) {
                                    switch (i.label) {
                                    case 0:
                                        return this.privIsDisposed || this.privRequestSession.isSpeechEnded || !this.privRequestSession.isRecognizing || this.privRequestSession.recogNumber !== c ? [3, 5] : [4, this.fetchConnection()];
                                    case 1:
                                        return n = i.sent(),
                                        [4, e.read()];
                                    case 2:
                                        return o = i.sent(),
                                        this.privRequestSession.isSpeechEnded ? [2] : (l = void 0,
                                        f = void 0,
                                        !o || o.isEnd ? (l = null,
                                        f = 0) : (l = o.buffer,
                                        this.privRequestSession.onAudioSent(l.byteLength),
                                        f = a >= this.privRequestSession.bytesSent ? 0 : Math.max(0, r - Date.now())),
                                        0 === f ? [3, 4] : [4, this.delay(f)]);
                                    case 3:
                                        i.sent(),
                                        i.label = 4;
                                    case 4:
                                        if (null !== l && (r = Date.now() + 1e3 * l.byteLength / (2 * t.avgBytesPerSec)),
                                        !this.privIsDisposed && !this.privRequestSession.isSpeechEnded && this.privRequestSession.isRecognizing && this.privRequestSession.recogNumber === c) {
                                            if (n.send(new u.SpeechConnectionMessage(s.MessageType.Binary,"audio",this.privRequestSession.requestId,null,l)).catch((function() {
                                                h.privRequestSession.onServiceTurnEndResponse(h.privRecognizerConfig.isContinuousRecognition).catch((function() {}
                                                ))
                                            }
                                            )),
                                            !(null == o ? void 0 : o.isEnd))
                                                return [2, p()];
                                            this.privIsLiveAudio || this.privRequestSession.onSpeechEnded()
                                        }
                                        i.label = 5;
                                    case 5:
                                        return [2]
                                    }
                                }
                                ))
                            }
                            ))
                        }
                        )()]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.retryableConnect = function() {
            return n(this, void 0, void 0, (function() {
                var e, t, r, n, o, c, u, p = this;
                return i(this, (function(i) {
                    switch (i.label) {
                    case 0:
                        e = !1,
                        this.privAuthFetchEventId = s.createNoDashGuid(),
                        t = this.privRequestSession.sessionId,
                        this.privConnectionId = void 0 !== t ? t : s.createNoDashGuid(),
                        this.privRequestSession.onPreConnectionStart(this.privAuthFetchEventId, this.privConnectionId),
                        r = 0,
                        n = "",
                        i.label = 1;
                    case 1:
                        return this.privRequestSession.numConnectionAttempts <= this.privRecognizerConfig.maxRetryCount ? [4, e ? this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId) : this.privAuthentication.fetch(this.privAuthFetchEventId)] : [3, 8];
                    case 2:
                        return o = i.sent(),
                        [4, this.privRequestSession.onAuthCompleted(!1)];
                    case 3:
                        return i.sent(),
                        c = this.privConnectionFactory.create(this.privRecognizerConfig, o, this.privConnectionId),
                        this.privRequestSession.listenForServiceTelemetry(c.events),
                        c.events.attach((function(e) {
                            p.connectionEvents.onEvent(e)
                        }
                        )),
                        [4, c.open()];
                    case 4:
                        return 200 !== (u = i.sent()).statusCode ? [3, 6] : [4, this.privRequestSession.onConnectionEstablishCompleted(u.statusCode)];
                    case 5:
                        return i.sent(),
                        [2, Promise.resolve(c)];
                    case 6:
                        1006 === u.statusCode && (e = !0),
                        i.label = 7;
                    case 7:
                        return r = u.statusCode,
                        n = u.reason,
                        this.privRequestSession.onRetryConnection(),
                        [3, 1];
                    case 8:
                        return [4, this.privRequestSession.onConnectionEstablishCompleted(r, n)];
                    case 9:
                        return i.sent(),
                        [2, Promise.reject("Unable to contact server. StatusCode: " + r + ", " + this.privRecognizerConfig.parameters.getProperty(a.PropertyId.SpeechServiceConnection_Endpoint) + " Reason: " + n)]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.delay = function(e) {
            var t = this;
            return new Promise((function(r, n) {
                t.privSetTimeout(r, e)
            }
            ))
        }
        ,
        e.prototype.writeBufferToConsole = function(e) {
            var t = "Buffer Size: ";
            if (null === e)
                t += "null";
            else {
                var r = new Uint8Array(e);
                t += e.byteLength + "\r\n";
                for (var n = 0; n < e.byteLength; n++)
                    t += r[n].toString(16).padStart(2, "0") + " "
            }
            console.info(t)
        }
        ,
        e.prototype.sendFinalAudio = function() {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(e) {
                    switch (e.label) {
                    case 0:
                        return [4, this.fetchConnection()];
                    case 1:
                        return [4, e.sent().send(new u.SpeechConnectionMessage(s.MessageType.Binary,"audio",this.privRequestSession.requestId,null,null))];
                    case 2:
                        return e.sent(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.configureConnection = function() {
            return n(this, void 0, void 0, (function() {
                var e;
                return i(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return [4, this.connectImpl()];
                    case 1:
                        return e = t.sent(),
                        void 0 !== this.configConnectionOverride ? [2, this.configConnectionOverride(e)] : [4, this.sendSpeechServiceConfig(e, this.privRequestSession, this.privRecognizerConfig.SpeechServiceConfig.serialize())];
                    case 2:
                        return t.sent(),
                        [4, this.sendPrePayloadJSON(e)];
                    case 3:
                        return t.sent(),
                        [2, e]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.telemetryDataEnabled = !0,
        e
    }();
    t.ServiceRecognizerBase = p
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeechConnectionMessage = void 0;
    var o = r(4)
      , s = r(55)
      , a = function(e) {
        function t(t, r, n, i, a, c, u, p) {
            var l = this;
            if (!r)
                throw new o.ArgumentNullError("path");
            if (!n)
                throw new o.ArgumentNullError("requestId");
            var f = {};
            if (f[s.HeaderNames.Path] = r,
            f[s.HeaderNames.RequestId] = n,
            f[s.HeaderNames.RequestTimestamp] = (new Date).toISOString(),
            i && (f[s.HeaderNames.ContentType] = i),
            c && (f[s.HeaderNames.RequestStreamId] = c),
            u)
                for (var h in u)
                    h && (f[h] = u[h]);
            return (l = p ? e.call(this, t, a, f, p) || this : e.call(this, t, a, f) || this).privPath = r,
            l.privRequestId = n,
            l.privContentType = i,
            l.privStreamId = c,
            l.privAdditionalHeaders = u,
            l
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "path", {
            get: function() {
                return this.privPath
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "requestId", {
            get: function() {
                return this.privRequestId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "contentType", {
            get: function() {
                return this.privContentType
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "streamId", {
            get: function() {
                return this.privStreamId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "additionalHeaders", {
            get: function() {
                return this.privAdditionalHeaders
            },
            enumerable: !1,
            configurable: !0
        }),
        t.fromConnectionMessage = function(e) {
            var r = null
              , n = null
              , i = null
              , o = null
              , a = {};
            if (e.headers)
                for (var c in e.headers)
                    c && (c.toLowerCase() === s.HeaderNames.Path.toLowerCase() ? r = e.headers[c] : c.toLowerCase() === s.HeaderNames.RequestId.toLowerCase() ? n = e.headers[c] : c.toLowerCase() === s.HeaderNames.RequestTimestamp.toLowerCase() ? e.headers[c] : c.toLowerCase() === s.HeaderNames.ContentType.toLowerCase() ? i = e.headers[c] : c.toLowerCase() === s.HeaderNames.RequestStreamId.toLowerCase() ? o = e.headers[c] : a[c] = e.headers[c]);
            return new t(e.messageType,r,n,i,e.body,o,a,e.id)
        }
        ,
        t
    }(o.ConnectionMessage);
    t.SpeechConnectionMessage = a
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.type = t.connectivity = t.Device = t.OS = t.System = t.Context = t.SpeechServiceConfig = t.RecognizerConfig = t.SpeechResultFormat = t.RecognitionMode = void 0;
    var n, i = r(61);
    !function(e) {
        e[e.Interactive = 0] = "Interactive",
        e[e.Conversation = 1] = "Conversation",
        e[e.Dictation = 2] = "Dictation"
    }(n = t.RecognitionMode || (t.RecognitionMode = {})),
    function(e) {
        e[e.Simple = 0] = "Simple",
        e[e.Detailed = 1] = "Detailed"
    }(t.SpeechResultFormat || (t.SpeechResultFormat = {}));
    var o = function() {
        function e(e, t) {
            this.privRecognitionMode = n.Interactive,
            this.privSpeechServiceConfig = e || new s(new a(null)),
            this.privParameters = t,
            this.privMaxRetryCount = parseInt(t.getProperty("SPEECH-Error-MaxRetryCount", "4"), 10)
        }
        return Object.defineProperty(e.prototype, "parameters", {
            get: function() {
                return this.privParameters
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "recognitionMode", {
            get: function() {
                return this.privRecognitionMode
            },
            set: function(e) {
                this.privRecognitionMode = e,
                this.privRecognitionActivityTimeout = e === n.Interactive ? 8e3 : 25e3,
                this.privSpeechServiceConfig.Recognition = n[e]
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "SpeechServiceConfig", {
            get: function() {
                return this.privSpeechServiceConfig
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "recognitionActivityTimeout", {
            get: function() {
                return this.privRecognitionActivityTimeout
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "isContinuousRecognition", {
            get: function() {
                return this.privRecognitionMode !== n.Interactive
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "autoDetectSourceLanguages", {
            get: function() {
                return this.parameters.getProperty(i.PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, void 0)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "maxRetryCount", {
            get: function() {
                return this.privMaxRetryCount
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.RecognizerConfig = o;
    var s = function() {
        function e(e) {
            var t = this;
            this.serialize = function() {
                return JSON.stringify(t, (function(e, t) {
                    if (t && "object" == typeof t) {
                        var r = {};
                        for (var n in t)
                            Object.hasOwnProperty.call(t, n) && (r[n && n.charAt(0).toLowerCase() + n.substring(1)] = t[n]);
                        return r
                    }
                    return t
                }
                ))
            }
            ,
            this.context = e
        }
        return Object.defineProperty(e.prototype, "Context", {
            get: function() {
                return this.context
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Recognition", {
            get: function() {
                return this.recognition
            },
            set: function(e) {
                this.recognition = e.toLowerCase()
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.SpeechServiceConfig = s;
    var a = function(e) {
        this.system = new c,
        this.os = e
    };
    t.Context = a;
    var c = function() {
        this.name = "SpeechSDK",
        this.version = "1.19.0",
        this.build = "JavaScript",
        this.lang = "JavaScript"
    };
    t.System = c;
    var u = function(e, t, r) {
        this.platform = e,
        this.name = t,
        this.version = r
    };
    t.OS = u;
    var p = function(e, t, r) {
        this.manufacturer = e,
        this.model = t,
        this.version = r
    };
    t.Device = p,
    function(e) {
        e.Bluetooth = "Bluetooth",
        e.Wired = "Wired",
        e.WiFi = "WiFi",
        e.Cellular = "Cellular",
        e.InBuilt = "InBuilt",
        e.Unknown = "Unknown"
    }(t.connectivity || (t.connectivity = {})),
    function(e) {
        e.Phone = "Phone",
        e.Speaker = "Speaker",
        e.Car = "Car",
        e.Headset = "Headset",
        e.Thermostat = "Thermostat",
        e.Microphones = "Microphones",
        e.Deskphone = "Deskphone",
        e.RemoteControl = "RemoteControl",
        e.Unknown = "Unknown",
        e.File = "File",
        e.Stream = "Stream"
    }(t.type || (t.type = {}))
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    })
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.WebsocketMessageFormatter = void 0;
    var n = r(4)
      , i = function() {
        var e = this;
        this.toConnectionMessage = function(t) {
            var r = new n.Deferred;
            try {
                if (t.messageType === n.MessageType.Text) {
                    var i = t.textContent
                      , o = {}
                      , s = null;
                    if (i) {
                        var a = i.split("\r\n\r\n");
                        a && a.length > 0 && (o = e.parseHeaders(a[0]),
                        a.length > 1 && (s = a[1]))
                    }
                    r.resolve(new n.ConnectionMessage(t.messageType,s,o,t.id))
                } else if (t.messageType === n.MessageType.Binary) {
                    var c = t.binaryContent;
                    if (o = {},
                    s = null,
                    !c || c.byteLength < 2)
                        throw new Error("Invalid binary message format. Header length missing.");
                    var u = new DataView(c)
                      , p = u.getInt16(0);
                    if (c.byteLength < p + 2)
                        throw new Error("Invalid binary message format. Header content missing.");
                    for (var l = "", f = 0; f < p; f++)
                        l += String.fromCharCode(u.getInt8(f + 2));
                    o = e.parseHeaders(l),
                    c.byteLength > p + 2 && (s = c.slice(2 + p)),
                    r.resolve(new n.ConnectionMessage(t.messageType,s,o,t.id))
                }
            } catch (e) {
                r.reject("Error formatting the message. Error: " + e)
            }
            return r.promise
        }
        ,
        this.fromConnectionMessage = function(t) {
            var r = new n.Deferred;
            try {
                if (t.messageType === n.MessageType.Text) {
                    var i = e.makeHeaders(t) + "\r\n" + (t.textBody ? t.textBody : "");
                    r.resolve(new n.RawWebsocketMessage(n.MessageType.Text,i,t.id))
                } else if (t.messageType === n.MessageType.Binary) {
                    var o = e.makeHeaders(t)
                      , s = t.binaryBody
                      , a = e.stringToArrayBuffer(o)
                      , c = new Int8Array(a)
                      , u = c.byteLength
                      , p = new Int8Array(2 + u + (s ? s.byteLength : 0));
                    if (p[0] = u >> 8 & 255,
                    p[1] = 255 & u,
                    p.set(c, 2),
                    s) {
                        var l = new Int8Array(s);
                        p.set(l, 2 + u)
                    }
                    i = p.buffer,
                    r.resolve(new n.RawWebsocketMessage(n.MessageType.Binary,i,t.id))
                }
            } catch (e) {
                r.reject("Error formatting the message. " + e)
            }
            return r.promise
        }
        ,
        this.makeHeaders = function(e) {
            var t = "";
            if (e.headers)
                for (var r in e.headers)
                    r && (t += r + ": " + e.headers[r] + "\r\n");
            return t
        }
        ,
        this.parseHeaders = function(e) {
            var t = {};
            if (e) {
                var r = e.match(/[^\r\n]+/g);
                if (t)
                    for (var n = 0, i = r; n < i.length; n++) {
                        var o = i[n];
                        if (o) {
                            var s = o.indexOf(":")
                              , a = s > 0 ? o.substr(0, s).trim().toLowerCase() : o
                              , c = s > 0 && o.length > s + 1 ? o.substr(s + 1).trim() : "";
                            t[a] = c
                        }
                    }
            }
            return t
        }
        ,
        this.stringToArrayBuffer = function(e) {
            for (var t = new ArrayBuffer(e.length), r = new DataView(t), n = 0; n < e.length; n++)
                r.setUint8(n, e.charCodeAt(n));
            return t
        }
    };
    t.WebsocketMessageFormatter = i
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeechConnectionFactory = void 0;
    var o = r(2)
      , s = r(53)
      , a = r(61)
      , c = r(123)
      , u = r(53)
      , p = r(55)
      , l = r(124)
      , f = function(e) {
        function t() {
            var t = null !== e && e.apply(this, arguments) || this;
            return t.interactiveRelativeUri = "/speech/recognition/interactive/cognitiveservices/v1",
            t.conversationRelativeUri = "/speech/recognition/conversation/cognitiveservices/v1",
            t.dictationRelativeUri = "/speech/recognition/dictation/cognitiveservices/v1",
            t.create = function(e, r, n) {
                var i = e.parameters.getProperty(a.PropertyId.SpeechServiceConnection_Endpoint, void 0)
                  , f = e.parameters.getProperty(a.PropertyId.SpeechServiceConnection_Region, void 0)
                  , h = c.ConnectionFactoryBase.getHostSuffix(f)
                  , v = e.parameters.getProperty(a.PropertyId.SpeechServiceConnection_Host, "wss://" + f + ".stt.speech" + h)
                  , d = {}
                  , y = e.parameters.getProperty(a.PropertyId.SpeechServiceConnection_EndpointId, void 0)
                  , g = e.parameters.getProperty(a.PropertyId.SpeechServiceConnection_RecoLanguage, void 0);
                if (y ? i && -1 !== i.search(l.QueryParameterNames.CustomSpeechDeploymentId) || (d[l.QueryParameterNames.CustomSpeechDeploymentId] = y) : g && (i && -1 !== i.search(l.QueryParameterNames.Language) || (d[l.QueryParameterNames.Language] = g)),
                i && -1 !== i.search(l.QueryParameterNames.Format) || (d[l.QueryParameterNames.Format] = e.parameters.getProperty(s.OutputFormatPropertyName, a.OutputFormat[a.OutputFormat.Simple]).toLowerCase()),
                void 0 !== e.autoDetectSourceLanguages && (d[l.QueryParameterNames.EnableLanguageId] = "true"),
                t.setCommonUrlParams(e, d, i),
                !i)
                    switch (e.recognitionMode) {
                    case u.RecognitionMode.Conversation:
                        i = "true" === e.parameters.getProperty(s.ForceDictationPropertyName, "false") ? v + t.dictationRelativeUri : v + t.conversationRelativeUri;
                        break;
                    case u.RecognitionMode.Dictation:
                        i = v + t.dictationRelativeUri;
                        break;
                    default:
                        i = v + t.interactiveRelativeUri
                    }
                var m = {};
                void 0 !== r.token && "" !== r.token && (m[r.headerName] = r.token),
                m[p.HeaderNames.ConnectionId] = n,
                e.parameters.setProperty(a.PropertyId.SpeechServiceConnection_Url, i);
                var b = "true" === e.parameters.getProperty("SPEECH-EnableWebsocketCompression", "false");
                return new o.WebsocketConnection(i,d,m,new u.WebsocketMessageFormatter,o.ProxyInfo.fromRecognizerConfig(e),b,n)
            }
            ,
            t
        }
        return i(t, e),
        t
    }(c.ConnectionFactoryBase);
    t.SpeechConnectionFactory = f
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.TranscriberConnectionFactory = void 0;
    var o = r(2)
      , s = r(61)
      , a = r(123)
      , c = r(53)
      , u = r(55)
      , p = r(124)
      , l = function(e) {
        function t() {
            var t = null !== e && e.apply(this, arguments) || this;
            return t.multiaudioRelativeUri = "/speech/recognition/multiaudio",
            t.create = function(e, r, n) {
                var i = e.parameters.getProperty(s.PropertyId.SpeechServiceConnection_Endpoint, void 0)
                  , l = e.parameters.getProperty(s.PropertyId.SpeechServiceConnection_Region, "centralus")
                  , f = "wss://transcribe." + l + ".cts.speech" + a.ConnectionFactoryBase.getHostSuffix(l) + t.multiaudioRelativeUri
                  , h = e.parameters.getProperty(s.PropertyId.SpeechServiceConnection_Host, f)
                  , v = {}
                  , d = e.parameters.getProperty(s.PropertyId.SpeechServiceConnection_EndpointId, void 0)
                  , y = e.parameters.getProperty(s.PropertyId.SpeechServiceConnection_RecoLanguage, void 0);
                d ? i && -1 !== i.search(p.QueryParameterNames.CustomSpeechDeploymentId) || (v[p.QueryParameterNames.CustomSpeechDeploymentId] = d) : y && (i && -1 !== i.search(p.QueryParameterNames.Language) || (v[p.QueryParameterNames.Language] = y)),
                t.setCommonUrlParams(e, v, i),
                i || (i = h);
                var g = {};
                void 0 !== r.token && "" !== r.token && (g[r.headerName] = r.token),
                g[u.HeaderNames.ConnectionId] = n,
                e.parameters.setProperty(s.PropertyId.SpeechServiceConnection_Url, i);
                var m = "true" === e.parameters.getProperty("SPEECH-EnableWebsocketCompression", "false");
                return new o.WebsocketConnection(i,v,g,new c.WebsocketMessageFormatter,o.ProxyInfo.fromRecognizerConfig(e),m,n)
            }
            ,
            t
        }
        return i(t, e),
        t
    }(a.ConnectionFactoryBase);
    t.TranscriberConnectionFactory = l
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.TranslationConnectionFactory = void 0;
    var o = r(2)
      , s = r(61)
      , a = r(123)
      , c = r(53)
      , u = r(55)
      , p = r(124)
      , l = function(e) {
        function t() {
            var t = null !== e && e.apply(this, arguments) || this;
            return t.create = function(e, r, n) {
                var i = e.parameters.getProperty(s.PropertyId.SpeechServiceConnection_Endpoint, void 0);
                if (!i) {
                    var l = e.parameters.getProperty(s.PropertyId.SpeechServiceConnection_Region, void 0)
                      , f = a.ConnectionFactoryBase.getHostSuffix(l);
                    i = e.parameters.getProperty(s.PropertyId.SpeechServiceConnection_Host, "wss://" + l + ".s2s.speech" + f) + "/speech/translation/cognitiveservices/v1"
                }
                var h = {
                    from: e.parameters.getProperty(s.PropertyId.SpeechServiceConnection_RecoLanguage),
                    to: e.parameters.getProperty(s.PropertyId.SpeechServiceConnection_TranslationToLanguages)
                };
                t.setCommonUrlParams(e, h, i),
                t.setUrlParameter(s.PropertyId.SpeechServiceResponse_TranslationRequestStablePartialResult, p.QueryParameterNames.StableTranslation, e, h, i);
                void 0 !== e.parameters.getProperty(s.PropertyId.SpeechServiceConnection_TranslationVoice, void 0) && (h.voice = e.parameters.getProperty(s.PropertyId.SpeechServiceConnection_TranslationVoice),
                h.features = "texttospeech");
                var v = {};
                void 0 !== r.token && "" !== r.token && (v[r.headerName] = r.token),
                v[u.HeaderNames.ConnectionId] = n,
                e.parameters.setProperty(s.PropertyId.SpeechServiceConnection_Url, i);
                var d = "true" === e.parameters.getProperty("SPEECH-EnableWebsocketCompression", "false");
                return new o.WebsocketConnection(i,h,v,new c.WebsocketMessageFormatter,o.ProxyInfo.fromRecognizerConfig(e),d,n)
            }
            ,
            t
        }
        return i(t, e),
        t
    }(a.ConnectionFactoryBase);
    t.TranslationConnectionFactory = l
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeechSynthesisConnectionFactory = void 0;
    var n = r(2)
      , i = r(61)
      , o = r(123)
      , s = r(53)
      , a = r(55)
      , c = r(124)
      , u = function() {
        var e = this;
        this.synthesisUri = "/cognitiveservices/websocket/v1",
        this.create = function(t, r, u) {
            var p = t.parameters.getProperty(i.PropertyId.SpeechServiceConnection_Endpoint, void 0)
              , l = t.parameters.getProperty(i.PropertyId.SpeechServiceConnection_Region, void 0)
              , f = o.ConnectionFactoryBase.getHostSuffix(l)
              , h = t.parameters.getProperty(i.PropertyId.SpeechServiceConnection_EndpointId, void 0)
              , v = void 0 === h ? "tts" : "voice"
              , d = t.parameters.getProperty(i.PropertyId.SpeechServiceConnection_Host, "wss://" + l + "." + v + ".speech" + f);
            p || (p = d + e.synthesisUri);
            var y = {};
            void 0 !== r.token && "" !== r.token && (y[r.headerName] = r.token),
            y[a.HeaderNames.ConnectionId] = u,
            void 0 !== h && (y[c.QueryParameterNames.CustomVoiceDeploymentId] = h),
            t.parameters.setProperty(i.PropertyId.SpeechServiceConnection_Url, p);
            var g = "true" === t.parameters.getProperty("SPEECH-EnableWebsocketCompression", "false");
            return new n.WebsocketConnection(p,{},y,new s.WebsocketMessageFormatter,n.ProxyInfo.fromParameters(t.parameters),g,u)
        }
    };
    t.SpeechSynthesisConnectionFactory = u
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.EnumTranslation = void 0;
    var n = r(61)
      , i = r(53)
      , o = function() {
        function e() {}
        return e.implTranslateRecognitionResult = function(e) {
            var t = n.ResultReason.Canceled;
            switch (e) {
            case i.RecognitionStatus.Success:
                t = n.ResultReason.RecognizedSpeech;
                break;
            case i.RecognitionStatus.NoMatch:
            case i.RecognitionStatus.InitialSilenceTimeout:
            case i.RecognitionStatus.BabbleTimeout:
            case i.RecognitionStatus.EndOfDictation:
                t = n.ResultReason.NoMatch;
                break;
            case i.RecognitionStatus.Error:
            case i.RecognitionStatus.BadRequest:
            case i.RecognitionStatus.Forbidden:
            default:
                t = n.ResultReason.Canceled
            }
            return t
        }
        ,
        e.implTranslateCancelResult = function(e) {
            var t = n.CancellationReason.EndOfStream;
            switch (e) {
            case i.RecognitionStatus.Success:
            case i.RecognitionStatus.EndOfDictation:
            case i.RecognitionStatus.NoMatch:
                t = n.CancellationReason.EndOfStream;
                break;
            case i.RecognitionStatus.InitialSilenceTimeout:
            case i.RecognitionStatus.BabbleTimeout:
            case i.RecognitionStatus.Error:
            case i.RecognitionStatus.BadRequest:
            case i.RecognitionStatus.Forbidden:
            default:
                t = n.CancellationReason.Error
            }
            return t
        }
        ,
        e.implTranslateCancelErrorCode = function(e) {
            var t = n.CancellationErrorCode.NoError;
            switch (e) {
            case i.RecognitionStatus.Error:
                t = n.CancellationErrorCode.ServiceError;
                break;
            case i.RecognitionStatus.TooManyRequests:
                t = n.CancellationErrorCode.TooManyRequests;
                break;
            case i.RecognitionStatus.BadRequest:
                t = n.CancellationErrorCode.BadRequestParameters;
                break;
            case i.RecognitionStatus.Forbidden:
                t = n.CancellationErrorCode.Forbidden;
                break;
            default:
                t = n.CancellationErrorCode.NoError
            }
            return t
        }
        ,
        e.implTranslateErrorDetails = function(e) {
            var t = "The speech service encountered an internal error and could not continue.";
            switch (e) {
            case n.CancellationErrorCode.Forbidden:
                t = "The recognizer is using a free subscription that ran out of quota.";
                break;
            case n.CancellationErrorCode.BadRequestParameters:
                t = "Invalid parameter or unsupported audio format in the request.";
                break;
            case n.CancellationErrorCode.TooManyRequests:
                t = "The number of parallel requests exceeded the number of allowed concurrent transcriptions."
            }
            return t
        }
        ,
        e
    }();
    t.EnumTranslation = o
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.RecognitionStatus = t.SynthesisStatus = void 0,
    function(e) {
        e[e.Success = 0] = "Success",
        e[e.SynthesisEnd = 1] = "SynthesisEnd",
        e[e.Error = 2] = "Error"
    }(t.SynthesisStatus || (t.SynthesisStatus = {})),
    function(e) {
        e[e.Success = 0] = "Success",
        e[e.NoMatch = 1] = "NoMatch",
        e[e.InitialSilenceTimeout = 2] = "InitialSilenceTimeout",
        e[e.BabbleTimeout = 3] = "BabbleTimeout",
        e[e.Error = 4] = "Error",
        e[e.EndOfDictation = 5] = "EndOfDictation",
        e[e.TooManyRequests = 6] = "TooManyRequests",
        e[e.BadRequest = 7] = "BadRequest",
        e[e.Forbidden = 8] = "Forbidden"
    }(t.RecognitionStatus || (t.RecognitionStatus = {}))
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.TranslationSynthesisEnd = void 0;
    var n = r(53)
      , i = function() {
        function e(e) {
            this.privSynthesisEnd = JSON.parse(e),
            this.privSynthesisEnd.SynthesisStatus = n.SynthesisStatus[this.privSynthesisEnd.SynthesisStatus]
        }
        return e.fromJSON = function(t) {
            return new e(t)
        }
        ,
        Object.defineProperty(e.prototype, "SynthesisStatus", {
            get: function() {
                return this.privSynthesisEnd.SynthesisStatus
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "FailureReason", {
            get: function() {
                return this.privSynthesisEnd.FailureReason
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.TranslationSynthesisEnd = i
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.TranslationHypothesis = void 0;
    var n = r(45)
      , i = function() {
        function e(e) {
            this.privTranslationHypothesis = JSON.parse(e),
            this.privTranslationHypothesis.Translation.TranslationStatus = n.TranslationStatus[this.privTranslationHypothesis.Translation.TranslationStatus]
        }
        return e.fromJSON = function(t) {
            return new e(t)
        }
        ,
        Object.defineProperty(e.prototype, "Duration", {
            get: function() {
                return this.privTranslationHypothesis.Duration
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Offset", {
            get: function() {
                return this.privTranslationHypothesis.Offset
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Text", {
            get: function() {
                return this.privTranslationHypothesis.Text
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Translation", {
            get: function() {
                return this.privTranslationHypothesis.Translation
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.TranslationHypothesis = i
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.TranslationPhrase = void 0;
    var n = r(63)
      , i = r(53)
      , o = r(45)
      , s = function() {
        function e(e) {
            this.privTranslationPhrase = e,
            this.privTranslationPhrase.RecognitionStatus = i.RecognitionStatus[this.privTranslationPhrase.RecognitionStatus],
            void 0 !== this.privTranslationPhrase.Translation && (this.privTranslationPhrase.Translation.TranslationStatus = o.TranslationStatus[this.privTranslationPhrase.Translation.TranslationStatus])
        }
        return e.fromJSON = function(t) {
            return new e(JSON.parse(t))
        }
        ,
        e.fromTranslationResponse = function(t) {
            n.Contracts.throwIfNullOrUndefined(t, "translationResponse");
            var r = t.SpeechPhrase;
            return t.SpeechPhrase = void 0,
            r.Translation = t,
            r.Text = r.DisplayText,
            new e(r)
        }
        ,
        Object.defineProperty(e.prototype, "RecognitionStatus", {
            get: function() {
                return this.privTranslationPhrase.RecognitionStatus
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Offset", {
            get: function() {
                return this.privTranslationPhrase.Offset
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Duration", {
            get: function() {
                return this.privTranslationPhrase.Duration
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Text", {
            get: function() {
                return this.privTranslationPhrase.Text
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Translation", {
            get: function() {
                return this.privTranslationPhrase.Translation
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.TranslationPhrase = s
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    ), o = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
    , s = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.TranslationServiceRecognizer = void 0;
    var a = r(4)
      , c = r(61)
      , u = r(53)
      , p = function(e) {
        function t(t, r, n, i, a) {
            var c = e.call(this, t, r, n, i, a) || this;
            return c.privTranslationRecognizer = a,
            c.connectionEvents.attach((function(e) {
                return o(c, void 0, void 0, (function() {
                    return s(this, (function(t) {
                        switch (t.label) {
                        case 0:
                            return "ConnectionEstablishedEvent" !== e.name ? [3, 1] : (this.privTranslationRecognizer.onConnection(),
                            [3, 3]);
                        case 1:
                            return "ConnectionClosedEvent" !== e.name ? [3, 3] : [4, this.privTranslationRecognizer.onDisconnection()];
                        case 2:
                            t.sent(),
                            t.label = 3;
                        case 3:
                            return [2]
                        }
                    }
                    ))
                }
                ))
            }
            )),
            c
        }
        return i(t, e),
        t.prototype.processTypeSpecificMessages = function(e) {
            return o(this, void 0, void 0, (function() {
                var t, r, n, i, p, l, f, h, v, d = this;
                return s(this, (function(y) {
                    switch (y.label) {
                    case 0:
                        switch (t = new c.PropertyCollection,
                        r = !1,
                        n = function(n) {
                            return o(d, void 0, void 0, (function() {
                                var i, o, a, p, l;
                                return s(this, (function(s) {
                                    switch (s.label) {
                                    case 0:
                                        if (this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset + n.Offset + n.Duration),
                                        n.RecognitionStatus !== u.RecognitionStatus.Success)
                                            return [3, 1];
                                        if (o = this.fireEventForResult(n, t),
                                        this.privTranslationRecognizer.recognized)
                                            try {
                                                this.privTranslationRecognizer.recognized(this.privTranslationRecognizer, o)
                                            } catch (e) {}
                                        if (this.privSuccessCallback) {
                                            try {
                                                this.privSuccessCallback(o.result)
                                            } catch (e) {
                                                this.privErrorCallback && this.privErrorCallback(e)
                                            }
                                            this.privSuccessCallback = void 0,
                                            this.privErrorCallback = void 0
                                        }
                                        return [3, 5];
                                    case 1:
                                        return i = u.EnumTranslation.implTranslateRecognitionResult(n.RecognitionStatus),
                                        o = new c.TranslationRecognitionResult(void 0,this.privRequestSession.requestId,i,n.Text,n.Duration,this.privRequestSession.currentTurnAudioOffset + n.Offset,void 0,e.textBody,t),
                                        i !== c.ResultReason.Canceled ? [3, 3] : (a = u.EnumTranslation.implTranslateCancelResult(n.RecognitionStatus),
                                        p = u.EnumTranslation.implTranslateCancelErrorCode(n.RecognitionStatus),
                                        [4, this.cancelRecognitionLocal(a, p, u.EnumTranslation.implTranslateErrorDetails(p))]);
                                    case 2:
                                        return s.sent(),
                                        [3, 4];
                                    case 3:
                                        if ((!this.privRequestSession.isSpeechEnded || i !== c.ResultReason.NoMatch || n.RecognitionStatus === u.RecognitionStatus.InitialSilenceTimeout) && (l = new c.TranslationRecognitionEventArgs(o,o.offset,this.privRequestSession.sessionId),
                                        this.privTranslationRecognizer.recognized))
                                            try {
                                                this.privTranslationRecognizer.recognized(this.privTranslationRecognizer, l)
                                            } catch (e) {}
                                        if (this.privSuccessCallback) {
                                            try {
                                                this.privSuccessCallback(o)
                                            } catch (e) {
                                                this.privErrorCallback && this.privErrorCallback(e)
                                            }
                                            this.privSuccessCallback = void 0,
                                            this.privErrorCallback = void 0
                                        }
                                        s.label = 4;
                                    case 4:
                                        r = !0,
                                        s.label = 5;
                                    case 5:
                                        return [2]
                                    }
                                }
                                ))
                            }
                            ))
                        }
                        ,
                        e.messageType === a.MessageType.Text && t.setProperty(c.PropertyId.SpeechServiceResponse_JsonResult, e.textBody),
                        e.path.toLowerCase()) {
                        case "translation.hypothesis":
                            return [3, 1];
                        case "translation.response":
                            return [3, 2];
                        case "translation.phrase":
                            return [3, 5];
                        case "translation.synthesis":
                            return [3, 7];
                        case "translation.synthesis.end":
                            return [3, 8]
                        }
                        return [3, 9];
                    case 1:
                        if (i = this.fireEventForResult(u.TranslationHypothesis.fromJSON(e.textBody), t),
                        this.privRequestSession.onHypothesis(this.privRequestSession.currentTurnAudioOffset + i.offset),
                        this.privTranslationRecognizer.recognizing)
                            try {
                                this.privTranslationRecognizer.recognizing(this.privTranslationRecognizer, i)
                            } catch (e) {}
                        return r = !0,
                        [3, 10];
                    case 2:
                        return (p = JSON.parse(e.textBody)).SpeechPhrase ? [4, n(u.TranslationPhrase.fromTranslationResponse(p))] : [3, 4];
                    case 3:
                        y.sent(),
                        y.label = 4;
                    case 4:
                        return [3, 10];
                    case 5:
                        return [4, n(u.TranslationPhrase.fromJSON(e.textBody))];
                    case 6:
                        return y.sent(),
                        [3, 10];
                    case 7:
                        return this.sendSynthesisAudio(e.binaryBody, this.privRequestSession.sessionId),
                        r = !0,
                        [3, 10];
                    case 8:
                        switch ((l = u.TranslationSynthesisEnd.fromJSON(e.textBody)).SynthesisStatus) {
                        case u.SynthesisStatus.Error:
                            if (this.privTranslationRecognizer.synthesizing) {
                                f = new c.TranslationSynthesisResult(c.ResultReason.Canceled,void 0),
                                h = new c.TranslationSynthesisEventArgs(f,this.privRequestSession.sessionId);
                                try {
                                    this.privTranslationRecognizer.synthesizing(this.privTranslationRecognizer, h)
                                } catch (e) {}
                            }
                            if (this.privTranslationRecognizer.canceled) {
                                v = new c.TranslationRecognitionCanceledEventArgs(this.privRequestSession.sessionId,c.CancellationReason.Error,l.FailureReason,c.CancellationErrorCode.ServiceError,null);
                                try {
                                    this.privTranslationRecognizer.canceled(this.privTranslationRecognizer, v)
                                } catch (e) {}
                            }
                            break;
                        case u.SynthesisStatus.Success:
                            this.sendSynthesisAudio(void 0, this.privRequestSession.sessionId)
                        }
                        return r = !0,
                        [3, 10];
                    case 9:
                        return [3, 10];
                    case 10:
                        return [2, r]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.cancelRecognition = function(e, t, r, n, i) {
            var o = new c.PropertyCollection;
            if (o.setProperty(u.CancellationErrorCodePropertyName, c.CancellationErrorCode[n]),
            this.privTranslationRecognizer.canceled) {
                var s = new c.TranslationRecognitionCanceledEventArgs(e,r,i,n,void 0);
                try {
                    this.privTranslationRecognizer.canceled(this.privTranslationRecognizer, s)
                } catch (e) {}
            }
            if (this.privSuccessCallback) {
                var a = new c.TranslationRecognitionResult(void 0,t,c.ResultReason.Canceled,void 0,void 0,void 0,i,void 0,o);
                try {
                    this.privSuccessCallback(a),
                    this.privSuccessCallback = void 0
                } catch (e) {}
            }
        }
        ,
        t.prototype.fireEventForResult = function(e, t) {
            var r, n;
            if (void 0 !== e.Translation.Translations) {
                r = new c.Translations;
                for (var i = 0, o = e.Translation.Translations; i < o.length; i++) {
                    var s = o[i];
                    r.set(s.Language, s.Text || s.DisplayText)
                }
            }
            n = e instanceof u.TranslationPhrase ? e.Translation.TranslationStatus === a.TranslationStatus.Success ? c.ResultReason.TranslatedSpeech : c.ResultReason.RecognizedSpeech : c.ResultReason.TranslatingSpeech;
            var p = e.Offset + this.privRequestSession.currentTurnAudioOffset
              , l = new c.TranslationRecognitionResult(r,this.privRequestSession.requestId,n,e.Text,e.Duration,p,e.Translation.FailureReason,JSON.stringify(e),t);
            return new c.TranslationRecognitionEventArgs(l,p,this.privRequestSession.sessionId)
        }
        ,
        t.prototype.sendSynthesisAudio = function(e, t) {
            var r = void 0 === e ? c.ResultReason.SynthesizingAudioCompleted : c.ResultReason.SynthesizingAudio
              , n = new c.TranslationSynthesisResult(r,e)
              , i = new c.TranslationSynthesisEventArgs(n,t);
            if (this.privTranslationRecognizer.synthesizing)
                try {
                    this.privTranslationRecognizer.synthesizing(this.privTranslationRecognizer, i)
                } catch (e) {}
        }
        ,
        t
    }(u.ServiceRecognizerBase);
    t.TranslationServiceRecognizer = p
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeechDetected = void 0;
    var n = function() {
        function e(e) {
            this.privSpeechStartDetected = JSON.parse(e)
        }
        return e.fromJSON = function(t) {
            return new e(t)
        }
        ,
        Object.defineProperty(e.prototype, "Offset", {
            get: function() {
                return this.privSpeechStartDetected.Offset
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.SpeechDetected = n
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeechHypothesis = void 0;
    var n = function() {
        function e(e) {
            this.privSpeechHypothesis = JSON.parse(e)
        }
        return e.fromJSON = function(t) {
            return new e(t)
        }
        ,
        Object.defineProperty(e.prototype, "Text", {
            get: function() {
                return this.privSpeechHypothesis.Text
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Offset", {
            get: function() {
                return this.privSpeechHypothesis.Offset
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Duration", {
            get: function() {
                return this.privSpeechHypothesis.Duration
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Language", {
            get: function() {
                return void 0 === this.privSpeechHypothesis.PrimaryLanguage ? void 0 : this.privSpeechHypothesis.PrimaryLanguage.Language
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "LanguageDetectionConfidence", {
            get: function() {
                return void 0 === this.privSpeechHypothesis.PrimaryLanguage ? void 0 : this.privSpeechHypothesis.PrimaryLanguage.Confidence
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "SpeakerId", {
            get: function() {
                return this.privSpeechHypothesis.SpeakerId
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.SpeechHypothesis = n
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeechKeyword = void 0;
    var n = function() {
        function e(e) {
            this.privSpeechKeyword = JSON.parse(e)
        }
        return e.fromJSON = function(t) {
            return new e(t)
        }
        ,
        Object.defineProperty(e.prototype, "Status", {
            get: function() {
                return this.privSpeechKeyword.Status
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Text", {
            get: function() {
                return this.privSpeechKeyword.Text
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Offset", {
            get: function() {
                return this.privSpeechKeyword.Offset
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Duration", {
            get: function() {
                return this.privSpeechKeyword.Duration
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.SpeechKeyword = n
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    ), o = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
    , s = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeechServiceRecognizer = void 0;
    var a = r(61)
      , c = r(53)
      , u = function(e) {
        function t(t, r, n, i, o) {
            var s = e.call(this, t, r, n, i, o) || this;
            if (s.privSpeechRecognizer = o,
            void 0 !== i.autoDetectSourceLanguages) {
                var a = i.autoDetectSourceLanguages.split(",");
                s.privSpeechContext.setSection("languageId", {
                    languages: a,
                    onSuccess: {
                        action: "Recognize"
                    },
                    onUnknown: {
                        action: "None"
                    }
                }),
                s.privSpeechContext.setSection("phraseOutput", {
                    interimResults: {
                        resultType: "Auto"
                    },
                    phraseResults: {
                        resultType: "Always"
                    }
                })
            }
            return s
        }
        return i(t, e),
        t.prototype.processTypeSpecificMessages = function(e) {
            return o(this, void 0, void 0, (function() {
                var t, r, n, i, o, u, p, l, f, h, v, d, y, g;
                return s(this, (function(s) {
                    switch (s.label) {
                    case 0:
                        switch ((r = new a.PropertyCollection).setProperty(a.PropertyId.SpeechServiceResponse_JsonResult, e.textBody),
                        n = !1,
                        e.path.toLowerCase()) {
                        case "speech.hypothesis":
                        case "speech.fragment":
                            return [3, 1];
                        case "speech.phrase":
                            return [3, 2]
                        }
                        return [3, 6];
                    case 1:
                        if (i = c.SpeechHypothesis.fromJSON(e.textBody),
                        o = i.Offset + this.privRequestSession.currentTurnAudioOffset,
                        t = new a.SpeechRecognitionResult(this.privRequestSession.requestId,a.ResultReason.RecognizingSpeech,i.Text,i.Duration,o,i.Language,i.LanguageDetectionConfidence,void 0,void 0,e.textBody,r),
                        this.privRequestSession.onHypothesis(o),
                        u = new a.SpeechRecognitionEventArgs(t,i.Duration,this.privRequestSession.sessionId),
                        this.privSpeechRecognizer.recognizing)
                            try {
                                this.privSpeechRecognizer.recognizing(this.privSpeechRecognizer, u)
                            } catch (e) {}
                        return n = !0,
                        [3, 7];
                    case 2:
                        return p = c.SimpleSpeechPhrase.fromJSON(e.textBody),
                        l = c.EnumTranslation.implTranslateRecognitionResult(p.RecognitionStatus),
                        this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset + p.Offset + p.Duration),
                        a.ResultReason.Canceled !== l ? [3, 4] : (f = c.EnumTranslation.implTranslateCancelResult(p.RecognitionStatus),
                        h = c.EnumTranslation.implTranslateCancelErrorCode(p.RecognitionStatus),
                        [4, this.cancelRecognitionLocal(f, h, c.EnumTranslation.implTranslateErrorDetails(h))]);
                    case 3:
                        return s.sent(),
                        [3, 5];
                    case 4:
                        if ((!this.privRequestSession.isSpeechEnded || l !== a.ResultReason.NoMatch || p.RecognitionStatus === c.RecognitionStatus.InitialSilenceTimeout) && (this.privRecognizerConfig.parameters.getProperty(c.OutputFormatPropertyName) === a.OutputFormat[a.OutputFormat.Simple] ? t = new a.SpeechRecognitionResult(this.privRequestSession.requestId,l,p.DisplayText,p.Duration,p.Offset + this.privRequestSession.currentTurnAudioOffset,p.Language,p.LanguageDetectionConfidence,void 0,void 0,e.textBody,r) : (v = c.DetailedSpeechPhrase.fromJSON(e.textBody),
                        d = v.Offset + this.privRequestSession.currentTurnAudioOffset,
                        y = v.getJsonWithCorrectedOffsets(d),
                        t = new a.SpeechRecognitionResult(this.privRequestSession.requestId,l,v.RecognitionStatus === c.RecognitionStatus.Success ? v.NBest[0].Display : void 0,v.Duration,d,v.Language,v.LanguageDetectionConfidence,void 0,void 0,y,r)),
                        g = new a.SpeechRecognitionEventArgs(t,t.offset,this.privRequestSession.sessionId),
                        this.privSpeechRecognizer.recognized))
                            try {
                                this.privSpeechRecognizer.recognized(this.privSpeechRecognizer, g)
                            } catch (e) {}
                        if (this.privSuccessCallback) {
                            try {
                                this.privSuccessCallback(t)
                            } catch (e) {
                                this.privErrorCallback && this.privErrorCallback(e)
                            }
                            this.privSuccessCallback = void 0,
                            this.privErrorCallback = void 0
                        }
                        s.label = 5;
                    case 5:
                        return n = !0,
                        [3, 7];
                    case 6:
                        return [3, 7];
                    case 7:
                        return [2, n]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.cancelRecognition = function(e, t, r, n, i) {
            var o = new a.PropertyCollection;
            if (o.setProperty(c.CancellationErrorCodePropertyName, a.CancellationErrorCode[n]),
            this.privSpeechRecognizer.canceled) {
                var s = new a.SpeechRecognitionCanceledEventArgs(r,i,n,void 0,e);
                try {
                    this.privSpeechRecognizer.canceled(this.privSpeechRecognizer, s)
                } catch (e) {}
            }
            if (this.privSuccessCallback) {
                var u = new a.SpeechRecognitionResult(t,a.ResultReason.Canceled,void 0,void 0,void 0,void 0,void 0,void 0,i,void 0,o);
                try {
                    this.privSuccessCallback(u),
                    this.privSuccessCallback = void 0
                } catch (e) {}
            }
        }
        ,
        t
    }(c.ServiceRecognizerBase);
    t.SpeechServiceRecognizer = u
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    ), o = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
    , s = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.TranscriptionServiceRecognizer = void 0;
    var a = r(4)
      , c = r(61)
      , u = r(53)
      , p = r(170)
      , l = function(e) {
        function t(t, r, n, i, o) {
            var s = e.call(this, t, r, n, i, o) || this;
            return s.sendSpeechEvent = function(e, t) {
                var r = JSON.stringify(t);
                if (r)
                    return e.send(new p.SpeechConnectionMessage(a.MessageType.Text,"speech.event",s.privRequestSession.requestId,"application/json",r))
            }
            ,
            s.privTranscriberRecognizer = o,
            s.sendPrePayloadJSONOverride = s.sendTranscriptionStartJSON,
            s
        }
        return i(t, e),
        t.prototype.sendSpeechEventAsync = function(e, t) {
            return o(this, void 0, void 0, (function() {
                var r;
                return s(this, (function(n) {
                    switch (n.label) {
                    case 0:
                        return this.privRequestSession.isRecognizing ? [4, this.fetchConnection()] : [3, 3];
                    case 1:
                        return r = n.sent(),
                        [4, this.sendSpeechEvent(r, this.createSpeechEventPayload(e, t))];
                    case 2:
                        n.sent(),
                        n.label = 3;
                    case 3:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.processTypeSpecificMessages = function(e) {
            return o(this, void 0, void 0, (function() {
                var t, r, n, i, o, a, p, l, f, h, v, d, y, g;
                return s(this, (function(s) {
                    switch (s.label) {
                    case 0:
                        switch ((r = new c.PropertyCollection).setProperty(c.PropertyId.SpeechServiceResponse_JsonResult, e.textBody),
                        n = !1,
                        e.path.toLowerCase()) {
                        case "speech.hypothesis":
                        case "speech.fragment":
                            return [3, 1];
                        case "speech.phrase":
                            return [3, 2]
                        }
                        return [3, 6];
                    case 1:
                        if (i = u.SpeechHypothesis.fromJSON(e.textBody),
                        o = i.Offset + this.privRequestSession.currentTurnAudioOffset,
                        t = new c.SpeechRecognitionResult(this.privRequestSession.requestId,c.ResultReason.RecognizingSpeech,i.Text,i.Duration,o,i.Language,i.LanguageDetectionConfidence,i.SpeakerId,void 0,e.textBody,r),
                        this.privRequestSession.onHypothesis(o),
                        a = new c.SpeechRecognitionEventArgs(t,i.Duration,this.privRequestSession.sessionId),
                        this.privTranscriberRecognizer.recognizing)
                            try {
                                this.privTranscriberRecognizer.recognizing(this.privTranscriberRecognizer, a)
                            } catch (e) {}
                        return n = !0,
                        [3, 7];
                    case 2:
                        return p = u.SimpleSpeechPhrase.fromJSON(e.textBody),
                        l = u.EnumTranslation.implTranslateRecognitionResult(p.RecognitionStatus),
                        this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset + p.Offset + p.Duration),
                        c.ResultReason.Canceled !== l ? [3, 4] : (f = u.EnumTranslation.implTranslateCancelResult(p.RecognitionStatus),
                        h = u.EnumTranslation.implTranslateCancelErrorCode(p.RecognitionStatus),
                        [4, this.cancelRecognitionLocal(f, h, u.EnumTranslation.implTranslateErrorDetails(h))]);
                    case 3:
                        return s.sent(),
                        [3, 5];
                    case 4:
                        if ((!this.privRequestSession.isSpeechEnded || l !== c.ResultReason.NoMatch || p.RecognitionStatus === u.RecognitionStatus.InitialSilenceTimeout) && (this.privRecognizerConfig.parameters.getProperty(u.OutputFormatPropertyName) === c.OutputFormat[c.OutputFormat.Simple] ? t = new c.SpeechRecognitionResult(this.privRequestSession.requestId,l,p.DisplayText,p.Duration,p.Offset + this.privRequestSession.currentTurnAudioOffset,p.Language,p.LanguageDetectionConfidence,p.SpeakerId,void 0,e.textBody,r) : (v = u.DetailedSpeechPhrase.fromJSON(e.textBody),
                        d = v.Offset + this.privRequestSession.currentTurnAudioOffset,
                        y = v.getJsonWithCorrectedOffsets(d),
                        t = new c.SpeechRecognitionResult(this.privRequestSession.requestId,l,v.Text,v.Duration,d,v.Language,v.LanguageDetectionConfidence,v.SpeakerId,void 0,y,r)),
                        g = new c.SpeechRecognitionEventArgs(t,t.offset,this.privRequestSession.sessionId),
                        this.privTranscriberRecognizer.recognized))
                            try {
                                this.privTranscriberRecognizer.recognized(this.privTranscriberRecognizer, g)
                            } catch (e) {}
                        if (this.privSuccessCallback) {
                            try {
                                this.privSuccessCallback(t)
                            } catch (e) {
                                this.privErrorCallback && this.privErrorCallback(e)
                            }
                            this.privSuccessCallback = void 0,
                            this.privErrorCallback = void 0
                        }
                        s.label = 5;
                    case 5:
                        return n = !0,
                        [3, 7];
                    case 6:
                        return [3, 7];
                    case 7:
                        return [2, n]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.cancelRecognition = function(e, t, r, n, i) {
            var o = new c.PropertyCollection;
            if (o.setProperty(u.CancellationErrorCodePropertyName, c.CancellationErrorCode[n]),
            this.privTranscriberRecognizer.canceled) {
                var s = new c.ConversationTranscriptionCanceledEventArgs(r,i,n,void 0,e);
                try {
                    this.privTranscriberRecognizer.canceled(this.privTranscriberRecognizer, s)
                } catch (e) {}
            }
            if (this.privSuccessCallback) {
                var a = new c.SpeechRecognitionResult(t,c.ResultReason.Canceled,void 0,void 0,void 0,void 0,void 0,void 0,i,void 0,o);
                try {
                    this.privSuccessCallback(a),
                    this.privSuccessCallback = void 0
                } catch (e) {}
            }
        }
        ,
        t.prototype.sendTranscriptionStartJSON = function(e) {
            return o(this, void 0, void 0, (function() {
                var t, r;
                return s(this, (function(n) {
                    switch (n.label) {
                    case 0:
                        return [4, this.sendSpeechContext(e)];
                    case 1:
                        return n.sent(),
                        t = this.privTranscriberRecognizer.getConversationInfo(),
                        r = this.createSpeechEventPayload(t, "start"),
                        [4, this.sendSpeechEvent(e, r)];
                    case 2:
                        return n.sent(),
                        [4, this.sendWaveHeader(e)];
                    case 3:
                        return n.sent(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.createSpeechEventPayload = function(e, t) {
            var r = "meeting"
              , n = {
                id: r,
                name: t,
                meeting: e.conversationProperties
            };
            return n.meeting.id = e.id,
            n.meeting.attendees = e.participants,
            n.meeting.record = "on" === e.conversationProperties.audiorecording ? "true" : "false",
            n
        }
        ,
        t
    }(u.ServiceRecognizerBase);
    t.TranscriptionServiceRecognizer = l
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.DetailedSpeechPhrase = void 0;
    var n = r(53)
      , i = function() {
        function e(e) {
            this.privDetailedSpeechPhrase = JSON.parse(e),
            this.privDetailedSpeechPhrase.RecognitionStatus = n.RecognitionStatus[this.privDetailedSpeechPhrase.RecognitionStatus]
        }
        return e.fromJSON = function(t) {
            return new e(t)
        }
        ,
        e.prototype.getJsonWithCorrectedOffsets = function(e) {
            if (this.privDetailedSpeechPhrase.NBest && this.privDetailedSpeechPhrase.NBest[0].Words) {
                var t = this.privDetailedSpeechPhrase.NBest[0].Words[0].Offset;
                if (t && t < e)
                    for (var r = e - t, n = 0, i = this.privDetailedSpeechPhrase.NBest; n < i.length; n++) {
                        var o = i[n];
                        if (o.Words)
                            for (var s = 0, a = o.Words; s < a.length; s++) {
                                a[s].Offset += r
                            }
                    }
            }
            return JSON.stringify(this.privDetailedSpeechPhrase)
        }
        ,
        Object.defineProperty(e.prototype, "RecognitionStatus", {
            get: function() {
                return this.privDetailedSpeechPhrase.RecognitionStatus
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "NBest", {
            get: function() {
                return this.privDetailedSpeechPhrase.NBest
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Duration", {
            get: function() {
                return this.privDetailedSpeechPhrase.Duration
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Offset", {
            get: function() {
                return this.privDetailedSpeechPhrase.Offset
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Language", {
            get: function() {
                return void 0 === this.privDetailedSpeechPhrase.PrimaryLanguage ? void 0 : this.privDetailedSpeechPhrase.PrimaryLanguage.Language
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "LanguageDetectionConfidence", {
            get: function() {
                return void 0 === this.privDetailedSpeechPhrase.PrimaryLanguage ? void 0 : this.privDetailedSpeechPhrase.PrimaryLanguage.Confidence
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Text", {
            get: function() {
                return this.privDetailedSpeechPhrase.NBest && this.privDetailedSpeechPhrase.NBest[0] ? this.privDetailedSpeechPhrase.NBest[0].Display : this.privDetailedSpeechPhrase.DisplayText
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "SpeakerId", {
            get: function() {
                return this.privDetailedSpeechPhrase.SpeakerId
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.DetailedSpeechPhrase = i
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SimpleSpeechPhrase = void 0;
    var n = r(53)
      , i = function() {
        function e(e) {
            this.privSimpleSpeechPhrase = JSON.parse(e),
            this.privSimpleSpeechPhrase.RecognitionStatus = n.RecognitionStatus[this.privSimpleSpeechPhrase.RecognitionStatus]
        }
        return e.fromJSON = function(t) {
            return new e(t)
        }
        ,
        Object.defineProperty(e.prototype, "RecognitionStatus", {
            get: function() {
                return this.privSimpleSpeechPhrase.RecognitionStatus
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "DisplayText", {
            get: function() {
                return this.privSimpleSpeechPhrase.DisplayText
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Offset", {
            get: function() {
                return this.privSimpleSpeechPhrase.Offset
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Duration", {
            get: function() {
                return this.privSimpleSpeechPhrase.Duration
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Language", {
            get: function() {
                return void 0 === this.privSimpleSpeechPhrase.PrimaryLanguage ? void 0 : this.privSimpleSpeechPhrase.PrimaryLanguage.Language
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "LanguageDetectionConfidence", {
            get: function() {
                return void 0 === this.privSimpleSpeechPhrase.PrimaryLanguage ? void 0 : this.privSimpleSpeechPhrase.PrimaryLanguage.Confidence
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "SpeakerId", {
            get: function() {
                return this.privSimpleSpeechPhrase.SpeakerId
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.SimpleSpeechPhrase = i
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.AddedLmIntent = void 0;
    var n = function(e, t) {
        this.modelImpl = e,
        this.intentName = t
    };
    t.AddedLmIntent = n
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    ), o = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
    , s = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.IntentServiceRecognizer = void 0;
    var a = r(4)
      , c = r(61)
      , u = r(53)
      , p = function(e) {
        function t(t, r, n, i, o) {
            var s = e.call(this, t, r, n, i, o) || this;
            return s.privIntentRecognizer = o,
            s.privIntentDataSent = !1,
            s
        }
        return i(t, e),
        t.prototype.setIntents = function(e, t) {
            this.privAddedLmIntents = e,
            this.privUmbrellaIntent = t,
            this.privIntentDataSent = !0
        }
        ,
        t.prototype.processTypeSpecificMessages = function(e) {
            return o(this, void 0, void 0, (function() {
                var t, r, n, i, o, p, l, f, h, v, d, y, g = this;
                return s(this, (function(s) {
                    switch (n = !1,
                    i = new c.PropertyCollection,
                    e.messageType === a.MessageType.Text && i.setProperty(c.PropertyId.SpeechServiceResponse_JsonResult, e.textBody),
                    e.path.toLowerCase()) {
                    case "speech.hypothesis":
                        if (o = u.SpeechHypothesis.fromJSON(e.textBody),
                        t = new c.IntentRecognitionResult(void 0,this.privRequestSession.requestId,c.ResultReason.RecognizingIntent,o.Text,o.Duration,o.Offset + this.privRequestSession.currentTurnAudioOffset,o.Language,o.LanguageDetectionConfidence,void 0,e.textBody,i),
                        this.privRequestSession.onHypothesis(t.offset),
                        r = new c.IntentRecognitionEventArgs(t,o.Offset + this.privRequestSession.currentTurnAudioOffset,this.privRequestSession.sessionId),
                        this.privIntentRecognizer.recognizing)
                            try {
                                this.privIntentRecognizer.recognizing(this.privIntentRecognizer, r)
                            } catch (e) {}
                        n = !0;
                        break;
                    case "speech.phrase":
                        p = u.SimpleSpeechPhrase.fromJSON(e.textBody),
                        t = new c.IntentRecognitionResult(void 0,this.privRequestSession.requestId,u.EnumTranslation.implTranslateRecognitionResult(p.RecognitionStatus),p.DisplayText,p.Duration,p.Offset + this.privRequestSession.currentTurnAudioOffset,p.Language,p.LanguageDetectionConfidence,void 0,e.textBody,i),
                        r = new c.IntentRecognitionEventArgs(t,t.offset,this.privRequestSession.sessionId),
                        l = function() {
                            if (g.privIntentRecognizer.recognized)
                                try {
                                    g.privIntentRecognizer.recognized(g.privIntentRecognizer, r)
                                } catch (e) {}
                            if (g.privSuccessCallback) {
                                try {
                                    g.privSuccessCallback(t)
                                } catch (e) {
                                    g.privErrorCallback && g.privErrorCallback(e)
                                }
                                g.privSuccessCallback = void 0,
                                g.privErrorCallback = void 0
                            }
                        }
                        ,
                        !1 === this.privIntentDataSent || c.ResultReason.NoMatch === r.result.reason ? (this.privRequestSession.onPhraseRecognized(r.offset + r.result.duration),
                        l()) : this.privPendingIntentArgs = r,
                        n = !0;
                        break;
                    case "response":
                        if (r = this.privPendingIntentArgs,
                        this.privPendingIntentArgs = void 0,
                        void 0 === r) {
                            if ("" === e.textBody)
                                return [2];
                            r = new c.IntentRecognitionEventArgs(new c.IntentRecognitionResult,0,this.privRequestSession.sessionId)
                        }
                        if (f = u.IntentResponse.fromJSON(e.textBody),
                        h = this.privAddedLmIntents[f.topScoringIntent.intent],
                        void 0 !== this.privUmbrellaIntent && (h = this.privUmbrellaIntent),
                        null !== f && void 0 !== h && (v = void 0 === h.intentName ? f.topScoringIntent.intent : h.intentName,
                        d = r.result.reason,
                        void 0 !== v && (d = c.ResultReason.RecognizedIntent),
                        (y = void 0 !== r.result.properties ? r.result.properties : new c.PropertyCollection).setProperty(c.PropertyId.LanguageUnderstandingServiceResponse_JsonResult, e.textBody),
                        r = new c.IntentRecognitionEventArgs(new c.IntentRecognitionResult(v,r.result.resultId,d,r.result.text,r.result.duration,r.result.offset,void 0,void 0,r.result.errorDetails,r.result.json,y),r.offset,r.sessionId)),
                        this.privRequestSession.onPhraseRecognized(r.offset + r.result.duration),
                        this.privIntentRecognizer.recognized)
                            try {
                                this.privIntentRecognizer.recognized(this.privIntentRecognizer, r)
                            } catch (e) {}
                        if (this.privSuccessCallback) {
                            try {
                                this.privSuccessCallback(r.result)
                            } catch (e) {
                                this.privErrorCallback && this.privErrorCallback(e)
                            }
                            this.privSuccessCallback = void 0,
                            this.privErrorCallback = void 0
                        }
                        n = !0
                    }
                    return [2, n]
                }
                ))
            }
            ))
        }
        ,
        t.prototype.cancelRecognition = function(e, t, r, n, i) {
            var o = new c.PropertyCollection;
            if (o.setProperty(u.CancellationErrorCodePropertyName, c.CancellationErrorCode[n]),
            this.privIntentRecognizer.canceled) {
                var s = new c.IntentRecognitionCanceledEventArgs(r,i,n,void 0,void 0,e);
                try {
                    this.privIntentRecognizer.canceled(this.privIntentRecognizer, s)
                } catch (e) {}
            }
            if (this.privSuccessCallback) {
                var a = new c.IntentRecognitionResult(void 0,t,c.ResultReason.Canceled,void 0,void 0,void 0,void 0,void 0,i,void 0,o);
                try {
                    this.privSuccessCallback(a),
                    this.privSuccessCallback = void 0
                } catch (e) {}
            }
        }
        ,
        t
    }(u.ServiceRecognizerBase);
    t.IntentServiceRecognizer = p
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.IntentResponse = void 0;
    var n = function() {
        function e(e) {
            this.privIntentResponse = JSON.parse(e)
        }
        return e.fromJSON = function(t) {
            return new e(t)
        }
        ,
        Object.defineProperty(e.prototype, "query", {
            get: function() {
                return this.privIntentResponse.query
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "topScoringIntent", {
            get: function() {
                return this.privIntentResponse.topScoringIntent
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "entities", {
            get: function() {
                return this.privIntentResponse.entities
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.IntentResponse = n
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
      , i = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.RequestSession = void 0;
    var o = r(4)
      , s = r(168)
      , a = r(195)
      , c = function() {
        function e(e) {
            var t = this;
            this.privIsDisposed = !1,
            this.privDetachables = new Array,
            this.privIsAudioNodeDetached = !1,
            this.privIsRecognizing = !1,
            this.privIsSpeechEnded = !1,
            this.privTurnStartAudioOffset = 0,
            this.privLastRecoOffset = 0,
            this.privHypothesisReceived = !1,
            this.privBytesSent = 0,
            this.privRecogNumber = 0,
            this.privInTurn = !1,
            this.privConnectionAttempts = 0,
            this.onPreConnectionStart = function(e, r) {
                t.privAuthFetchEventId = e,
                t.privSessionId = r,
                t.onEvent(new s.ConnectingToServiceEvent(t.privRequestId,t.privAuthFetchEventId,t.privSessionId))
            }
            ,
            this.onSpeechContext = function() {
                t.privRequestId = o.createNoDashGuid()
            }
            ,
            this.onServiceTurnStartResponse = function() {
                t.privTurnDeferral && t.privInTurn && (t.privTurnDeferral.reject("Another turn started before current completed."),
                t.privTurnDeferral.promise.then().catch((function() {}
                ))),
                t.privInTurn = !0,
                t.privTurnDeferral = new o.Deferred
            }
            ,
            this.getTelemetry = function() {
                return t.privServiceTelemetryListener.hasTelemetry ? t.privServiceTelemetryListener.getTelemetry() : null
            }
            ,
            this.onEvent = function(e) {
                t.privServiceTelemetryListener && t.privServiceTelemetryListener.onEvent(e),
                o.Events.instance.onEvent(e)
            }
            ,
            this.privAudioSourceId = e,
            this.privRequestId = o.createNoDashGuid(),
            this.privAudioNodeId = o.createNoDashGuid(),
            this.privTurnDeferral = new o.Deferred,
            this.privTurnDeferral.resolve()
        }
        return Object.defineProperty(e.prototype, "sessionId", {
            get: function() {
                return this.privSessionId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "requestId", {
            get: function() {
                return this.privRequestId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "audioNodeId", {
            get: function() {
                return this.privAudioNodeId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "turnCompletionPromise", {
            get: function() {
                return this.privTurnDeferral.promise
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "isSpeechEnded", {
            get: function() {
                return this.privIsSpeechEnded
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "isRecognizing", {
            get: function() {
                return this.privIsRecognizing
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "currentTurnAudioOffset", {
            get: function() {
                return this.privTurnStartAudioOffset
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "recogNumber", {
            get: function() {
                return this.privRecogNumber
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "numConnectionAttempts", {
            get: function() {
                return this.privConnectionAttempts
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "bytesSent", {
            get: function() {
                return this.privBytesSent
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.listenForServiceTelemetry = function(e) {
            this.privServiceTelemetryListener && this.privDetachables.push(e.attachListener(this.privServiceTelemetryListener))
        }
        ,
        e.prototype.startNewRecognition = function() {
            this.privIsSpeechEnded = !1,
            this.privIsRecognizing = !0,
            this.privTurnStartAudioOffset = 0,
            this.privLastRecoOffset = 0,
            this.privRecogNumber++,
            this.privServiceTelemetryListener = new a.ServiceTelemetryListener(this.privRequestId,this.privAudioSourceId,this.privAudioNodeId),
            this.onEvent(new s.RecognitionTriggeredEvent(this.requestId,this.privSessionId,this.privAudioSourceId,this.privAudioNodeId))
        }
        ,
        e.prototype.onAudioSourceAttachCompleted = function(e, t, r) {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(r) {
                    switch (r.label) {
                    case 0:
                        return this.privAudioNode = e,
                        this.privIsAudioNodeDetached = !1,
                        t ? [4, this.onComplete()] : [3, 2];
                    case 1:
                        return r.sent(),
                        [3, 3];
                    case 2:
                        this.onEvent(new s.ListeningStartedEvent(this.privRequestId,this.privSessionId,this.privAudioSourceId,this.privAudioNodeId)),
                        r.label = 3;
                    case 3:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.onAuthCompleted = function(e, t) {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return e ? [4, this.onComplete()] : [3, 2];
                    case 1:
                        t.sent(),
                        t.label = 2;
                    case 2:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.onConnectionEstablishCompleted = function(e, t) {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return 200 !== e ? [3, 1] : (this.onEvent(new s.RecognitionStartedEvent(this.requestId,this.privAudioSourceId,this.privAudioNodeId,this.privAuthFetchEventId,this.privSessionId)),
                        this.privAudioNode && this.privAudioNode.replay(),
                        this.privTurnStartAudioOffset = this.privLastRecoOffset,
                        this.privBytesSent = 0,
                        [2]);
                    case 1:
                        return 403 !== e ? [3, 3] : [4, this.onComplete()];
                    case 2:
                        t.sent(),
                        t.label = 3;
                    case 3:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.onServiceTurnEndResponse = function(e) {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return this.privTurnDeferral.resolve(),
                        e && !this.isSpeechEnded ? [3, 2] : [4, this.onComplete()];
                    case 1:
                        return t.sent(),
                        this.privInTurn = !1,
                        [3, 3];
                    case 2:
                        this.privTurnStartAudioOffset = this.privLastRecoOffset,
                        this.privAudioNode.replay(),
                        t.label = 3;
                    case 3:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.onHypothesis = function(e) {
            this.privHypothesisReceived || (this.privHypothesisReceived = !0,
            this.privServiceTelemetryListener.hypothesisReceived(this.privAudioNode.findTimeAtOffset(e)))
        }
        ,
        e.prototype.onPhraseRecognized = function(e) {
            this.privServiceTelemetryListener.phraseReceived(this.privAudioNode.findTimeAtOffset(e)),
            this.onServiceRecognized(e)
        }
        ,
        e.prototype.onServiceRecognized = function(e) {
            this.privLastRecoOffset = e,
            this.privHypothesisReceived = !1,
            this.privAudioNode.shrinkBuffers(e),
            this.privConnectionAttempts = 0
        }
        ,
        e.prototype.onAudioSent = function(e) {
            this.privBytesSent += e
        }
        ,
        e.prototype.onRetryConnection = function() {
            this.privConnectionAttempts++
        }
        ,
        e.prototype.dispose = function(e) {
            var t;
            return n(this, void 0, void 0, (function() {
                var e, r;
                return i(this, (function(n) {
                    switch (n.label) {
                    case 0:
                        if (this.privIsDisposed)
                            return [3, 5];
                        this.privIsDisposed = !0,
                        e = 0,
                        r = this.privDetachables,
                        n.label = 1;
                    case 1:
                        return e < r.length ? [4, r[e].detach()] : [3, 4];
                    case 2:
                        n.sent(),
                        n.label = 3;
                    case 3:
                        return e++,
                        [3, 1];
                    case 4:
                        null === (t = this.privServiceTelemetryListener) || void 0 === t || t.dispose(),
                        this.privIsRecognizing = !1,
                        n.label = 5;
                    case 5:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.onStopRecognizing = function() {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(e) {
                    switch (e.label) {
                    case 0:
                        return [4, this.onComplete()];
                    case 1:
                        return e.sent(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.onSpeechEnded = function() {
            this.privIsSpeechEnded = !0
        }
        ,
        e.prototype.onComplete = function() {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(e) {
                    switch (e.label) {
                    case 0:
                        return this.privIsRecognizing ? (this.privIsRecognizing = !1,
                        [4, this.detachAudioNode()]) : [3, 2];
                    case 1:
                        e.sent(),
                        e.label = 2;
                    case 2:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.detachAudioNode = function() {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(e) {
                    switch (e.label) {
                    case 0:
                        return this.privIsAudioNodeDetached ? [3, 2] : (this.privIsAudioNodeDetached = !0,
                        this.privAudioNode ? [4, this.privAudioNode.detach()] : [3, 2]);
                    case 1:
                        e.sent(),
                        e.label = 2;
                    case 2:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e
    }();
    t.RequestSession = c
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ServiceTelemetryListener = void 0;
    var n = r(4)
      , i = r(168)
      , o = function() {
        function e(e, t, r) {
            var o = this;
            this.privIsDisposed = !1,
            this.privListeningTriggerMetric = null,
            this.privMicMetric = null,
            this.privConnectionEstablishMetric = null,
            this.onEvent = function(e) {
                if (!o.privIsDisposed && (e instanceof i.RecognitionTriggeredEvent && e.requestId === o.privRequestId && (o.privListeningTriggerMetric = {
                    End: e.eventTime,
                    Name: "ListeningTrigger",
                    Start: e.eventTime
                }),
                e instanceof n.AudioStreamNodeAttachingEvent && e.audioSourceId === o.privAudioSourceId && e.audioNodeId === o.privAudioNodeId && (o.privMicStartTime = e.eventTime),
                e instanceof n.AudioStreamNodeAttachedEvent && e.audioSourceId === o.privAudioSourceId && e.audioNodeId === o.privAudioNodeId && (o.privMicStartTime = e.eventTime),
                e instanceof n.AudioSourceErrorEvent && e.audioSourceId === o.privAudioSourceId && (o.privMicMetric || (o.privMicMetric = {
                    End: e.eventTime,
                    Error: e.error,
                    Name: "Microphone",
                    Start: o.privMicStartTime
                })),
                e instanceof n.AudioStreamNodeErrorEvent && e.audioSourceId === o.privAudioSourceId && e.audioNodeId === o.privAudioNodeId && (o.privMicMetric || (o.privMicMetric = {
                    End: e.eventTime,
                    Error: e.error,
                    Name: "Microphone",
                    Start: o.privMicStartTime
                })),
                e instanceof n.AudioStreamNodeDetachedEvent && e.audioSourceId === o.privAudioSourceId && e.audioNodeId === o.privAudioNodeId && (o.privMicMetric || (o.privMicMetric = {
                    End: e.eventTime,
                    Name: "Microphone",
                    Start: o.privMicStartTime
                })),
                e instanceof i.ConnectingToServiceEvent && e.requestId === o.privRequestId && (o.privConnectionId = e.sessionId),
                e instanceof n.ConnectionStartEvent && e.connectionId === o.privConnectionId && (o.privConnectionStartTime = e.eventTime),
                e instanceof n.ConnectionEstablishedEvent && e.connectionId === o.privConnectionId && (o.privConnectionEstablishMetric || (o.privConnectionEstablishMetric = {
                    End: e.eventTime,
                    Id: o.privConnectionId,
                    Name: "Connection",
                    Start: o.privConnectionStartTime
                })),
                e instanceof n.ConnectionEstablishErrorEvent && e.connectionId === o.privConnectionId && (o.privConnectionEstablishMetric || (o.privConnectionEstablishMetric = {
                    End: e.eventTime,
                    Error: o.getConnectionError(e.statusCode),
                    Id: o.privConnectionId,
                    Name: "Connection",
                    Start: o.privConnectionStartTime
                })),
                e instanceof n.ConnectionMessageReceivedEvent && e.connectionId === o.privConnectionId && e.message && e.message.headers && e.message.headers.path)) {
                    o.privReceivedMessages[e.message.headers.path] || (o.privReceivedMessages[e.message.headers.path] = new Array);
                    o.privReceivedMessages[e.message.headers.path].length < 50 && o.privReceivedMessages[e.message.headers.path].push(e.networkReceivedTime)
                }
            }
            ,
            this.getTelemetry = function() {
                var e = new Array;
                o.privListeningTriggerMetric && e.push(o.privListeningTriggerMetric),
                o.privMicMetric && e.push(o.privMicMetric),
                o.privConnectionEstablishMetric && e.push(o.privConnectionEstablishMetric),
                o.privPhraseLatencies.length > 0 && e.push({
                    PhraseLatencyMs: o.privPhraseLatencies
                }),
                o.privHypothesisLatencies.length > 0 && e.push({
                    FirstHypothesisLatencyMs: o.privHypothesisLatencies
                });
                var t = {
                    Metrics: e,
                    ReceivedMessages: o.privReceivedMessages
                }
                  , r = JSON.stringify(t);
                return o.privReceivedMessages = {},
                o.privListeningTriggerMetric = null,
                o.privMicMetric = null,
                o.privConnectionEstablishMetric = null,
                o.privPhraseLatencies = [],
                o.privHypothesisLatencies = [],
                r
            }
            ,
            this.dispose = function() {
                o.privIsDisposed = !0
            }
            ,
            this.getConnectionError = function(e) {
                switch (e) {
                case 400:
                case 1002:
                case 1003:
                case 1005:
                case 1007:
                case 1008:
                case 1009:
                    return "BadRequest";
                case 401:
                    return "Unauthorized";
                case 403:
                    return "Forbidden";
                case 503:
                case 1001:
                    return "ServerUnavailable";
                case 500:
                case 1011:
                    return "ServerError";
                case 408:
                case 504:
                    return "Timeout";
                default:
                    return "statuscode:" + e.toString()
                }
            }
            ,
            this.privRequestId = e,
            this.privAudioSourceId = t,
            this.privAudioNodeId = r,
            this.privReceivedMessages = {},
            this.privPhraseLatencies = [],
            this.privHypothesisLatencies = []
        }
        return e.prototype.phraseReceived = function(e) {
            e > 0 && this.privPhraseLatencies.push(Date.now() - e)
        }
        ,
        e.prototype.hypothesisReceived = function(e) {
            e > 0 && this.privHypothesisLatencies.push(Date.now() - e)
        }
        ,
        Object.defineProperty(e.prototype, "hasTelemetry", {
            get: function() {
                return 0 !== Object.keys(this.privReceivedMessages).length || null !== this.privListeningTriggerMetric || null !== this.privMicMetric || null !== this.privConnectionEstablishMetric || 0 !== this.privPhraseLatencies.length || 0 !== this.privHypothesisLatencies.length
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.ServiceTelemetryListener = o
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeechContext = void 0;
    var n = function() {
        function e(e) {
            this.privContext = {},
            this.privDynamicGrammar = e
        }
        return e.prototype.setSection = function(e, t) {
            this.privContext[e] = t
        }
        ,
        e.prototype.setPronunciationAssessmentParams = function(e) {
            void 0 === this.privContext.phraseDetection && (this.privContext.phraseDetection = {
                enrichment: {
                    pronunciationAssessment: {}
                }
            }),
            this.privContext.phraseDetection.enrichment.pronunciationAssessment = JSON.parse(e),
            void 0 === this.privContext.phraseOutput && (this.privContext.phraseOutput = {
                detailed: {
                    options: []
                },
                format: {}
            }),
            this.privContext.phraseOutput.format = "Detailed",
            this.privContext.phraseOutput.detailed.options.push("PronunciationAssessment"),
            -1 === this.privContext.phraseOutput.detailed.options.indexOf("WordTimings") && this.privContext.phraseOutput.detailed.options.push("WordTimings"),
            -1 === this.privContext.phraseOutput.detailed.options.indexOf("SNR") && this.privContext.phraseOutput.detailed.options.push("SNR")
        }
        ,
        e.prototype.toJSON = function() {
            var e = this.privDynamicGrammar.generateGrammarObject();
            return this.setSection("dgi", e),
            JSON.stringify(this.privContext)
        }
        ,
        e
    }();
    t.SpeechContext = n
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.DynamicGrammarBuilder = void 0;
    var n = function() {
        function e() {}
        return e.prototype.addPhrase = function(e) {
            this.privPhrases || (this.privPhrases = []),
            e instanceof Array ? this.privPhrases = this.privPhrases.concat(e) : this.privPhrases.push(e)
        }
        ,
        e.prototype.clearPhrases = function() {
            this.privPhrases = void 0
        }
        ,
        e.prototype.addReferenceGrammar = function(e) {
            this.privGrammars || (this.privGrammars = []),
            e instanceof Array ? this.privGrammars = this.privGrammars.concat(e) : this.privGrammars.push(e)
        }
        ,
        e.prototype.clearGrammars = function() {
            this.privGrammars = void 0
        }
        ,
        e.prototype.generateGrammarObject = function() {
            if (void 0 !== this.privGrammars || void 0 !== this.privPhrases) {
                var e = {};
                if (e.ReferenceGrammars = this.privGrammars,
                void 0 !== this.privPhrases && 0 !== this.privPhrases.length) {
                    var t = [];
                    this.privPhrases.forEach((function(e, r, n) {
                        t.push({
                            Text: e
                        })
                    }
                    )),
                    e.Groups = [{
                        Type: "Generic",
                        Items: t
                    }]
                }
                return e
            }
        }
        ,
        e
    }();
    t.DynamicGrammarBuilder = n
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    })
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    ), o = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
    , s = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.DialogServiceAdapter = void 0;
    var a = r(2)
      , c = r(27)
      , u = r(4)
      , p = r(74)
      , l = r(61)
      , f = r(200)
      , h = r(53)
      , v = r(202)
      , d = r(170)
      , y = function(e) {
        function t(t, r, n, i, a) {
            var h = e.call(this, t, r, n, i, a) || this;
            return h.sendAgentConfig = function(e) {
                if (h.agentConfig && !h.agentConfigSent) {
                    if (h.privRecognizerConfig.parameters.getProperty(l.PropertyId.Conversation_DialogType) === l.DialogServiceConfig.DialogTypes.CustomCommands) {
                        var t = h.agentConfig.get();
                        t.botInfo.commandsCulture = h.privRecognizerConfig.parameters.getProperty(l.PropertyId.SpeechServiceConnection_RecoLanguage, "en-us"),
                        h.agentConfig.set(t)
                    }
                    h.onEvent(new c.SendingAgentContextMessageEvent(h.agentConfig));
                    var r = h.agentConfig.toJsonString();
                    return h.agentConfigSent = !0,
                    e.send(new d.SpeechConnectionMessage(u.MessageType.Text,"agent.config",h.privRequestSession.requestId,"application/json",r))
                }
            }
            ,
            h.sendAgentContext = function(e) {
                var t = u.createGuid()
                  , r = h.privDialogServiceConnector.properties.getProperty(l.PropertyId.Conversation_Speech_Activity_Template)
                  , n = {
                    channelData: "",
                    context: {
                        interactionId: t
                    },
                    messagePayload: void 0 === typeof r ? void 0 : r,
                    version: .5
                }
                  , i = JSON.stringify(n);
                return e.send(new d.SpeechConnectionMessage(u.MessageType.Text,"speech.agent.context",h.privRequestSession.requestId,"application/json",i))
            }
            ,
            h.handleResponseMessage = function(e) {
                var t = JSON.parse(e.textBody);
                switch (t.messageType.toLowerCase()) {
                case "message":
                    var r = e.requestId.toUpperCase()
                      , n = v.ActivityPayloadResponse.fromJSON(e.textBody)
                      , i = h.privTurnStateManager.GetTurn(r);
                    if (n.conversationId) {
                        var o = h.agentConfig.get();
                        o.botInfo.conversationId = n.conversationId,
                        h.agentConfig.set(o)
                    }
                    var s = i.processActivityPayload(n, p.AudioOutputFormatImpl.fromSpeechSynthesisOutputFormatString(h.privDialogServiceConnector.properties.getProperty(l.PropertyId.SpeechServiceConnection_SynthOutputFormat, void 0)))
                      , a = new l.ActivityReceivedEventArgs(n.messagePayload,s);
                    if (h.privDialogServiceConnector.activityReceived)
                        try {
                            h.privDialogServiceConnector.activityReceived(h.privDialogServiceConnector, a)
                        } catch (e) {}
                    break;
                case "messagestatus":
                    if (h.privDialogServiceConnector.turnStatusReceived)
                        try {
                            h.privDialogServiceConnector.turnStatusReceived(h.privDialogServiceConnector, new l.TurnStatusReceivedEventArgs(e.textBody))
                        } catch (e) {}
                    break;
                default:
                    u.Events.instance.onEvent(new u.BackgroundEvent("Unexpected response of type " + t.messageType + ". Ignoring."))
                }
            }
            ,
            h.privEvents = new u.EventSource,
            h.privDialogServiceConnector = a,
            h.receiveMessageOverride = h.receiveDialogMessageOverride,
            h.privTurnStateManager = new f.DialogServiceTurnStateManager,
            h.recognizeOverride = h.listenOnce,
            h.postConnectImplOverride = h.dialogConnectImpl,
            h.configConnectionOverride = h.configConnection,
            h.disconnectOverride = h.privDisconnect,
            h.privDialogAudioSource = n,
            h.agentConfigSent = !1,
            h.privLastResult = null,
            h.connectionEvents.attach((function(e) {
                return o(h, void 0, void 0, (function() {
                    return s(this, (function(t) {
                        return "ConnectionClosedEvent" === e.name && (this.terminateMessageLoop = !0),
                        [2]
                    }
                    ))
                }
                ))
            }
            )),
            h
        }
        return i(t, e),
        t.prototype.sendMessage = function(e) {
            return o(this, void 0, void 0, (function() {
                var t, r, n, i;
                return s(this, (function(o) {
                    switch (o.label) {
                    case 0:
                        return t = u.createGuid(),
                        r = u.createNoDashGuid(),
                        n = {
                            context: {
                                interactionId: t
                            },
                            messagePayload: JSON.parse(e),
                            version: .5
                        },
                        i = JSON.stringify(n),
                        [4, this.fetchConnection()];
                    case 1:
                        return [4, o.sent().send(new d.SpeechConnectionMessage(u.MessageType.Text,"agent",r,"application/json",i))];
                    case 2:
                        return o.sent(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.privDisconnect = function() {
            return o(this, void 0, void 0, (function() {
                return s(this, (function(e) {
                    switch (e.label) {
                    case 0:
                        return [4, this.cancelRecognition(this.privRequestSession.sessionId, this.privRequestSession.requestId, l.CancellationReason.Error, l.CancellationErrorCode.NoError, "Disconnecting")];
                    case 1:
                        return e.sent(),
                        this.terminateMessageLoop = !0,
                        this.agentConfigSent = !1,
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.processTypeSpecificMessages = function(e) {
            return o(this, void 0, void 0, (function() {
                var t, r, n, i, o, a, c, p, f, v, d, y;
                return s(this, (function(s) {
                    switch (t = new l.PropertyCollection,
                    e.messageType === u.MessageType.Text && t.setProperty(l.PropertyId.SpeechServiceResponse_JsonResult, e.textBody),
                    e.path.toLowerCase()) {
                    case "speech.phrase":
                        if (i = h.SimpleSpeechPhrase.fromJSON(e.textBody),
                        this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset + i.Offset + i.Duration),
                        i.RecognitionStatus !== h.RecognitionStatus.TooManyRequests && i.RecognitionStatus !== h.RecognitionStatus.Error && (o = this.fireEventForResult(i, t),
                        this.privLastResult = o.result,
                        this.privDialogServiceConnector.recognized))
                            try {
                                this.privDialogServiceConnector.recognized(this.privDialogServiceConnector, o)
                            } catch (e) {}
                        n = !0;
                        break;
                    case "speech.hypothesis":
                        if (a = h.SpeechHypothesis.fromJSON(e.textBody),
                        c = a.Offset + this.privRequestSession.currentTurnAudioOffset,
                        r = new l.SpeechRecognitionResult(this.privRequestSession.requestId,l.ResultReason.RecognizingSpeech,a.Text,a.Duration,c,a.Language,a.LanguageDetectionConfidence,void 0,void 0,e.textBody,t),
                        this.privRequestSession.onHypothesis(c),
                        p = new l.SpeechRecognitionEventArgs(r,a.Duration,this.privRequestSession.sessionId),
                        this.privDialogServiceConnector.recognizing)
                            try {
                                this.privDialogServiceConnector.recognizing(this.privDialogServiceConnector, p)
                            } catch (e) {}
                        n = !0;
                        break;
                    case "speech.keyword":
                        if (f = h.SpeechKeyword.fromJSON(e.textBody),
                        r = new l.SpeechRecognitionResult(this.privRequestSession.requestId,"Accepted" === f.Status ? l.ResultReason.RecognizedKeyword : l.ResultReason.NoMatch,f.Text,f.Duration,f.Offset,void 0,void 0,void 0,void 0,e.textBody,t),
                        "Accepted" !== f.Status && (this.privLastResult = r),
                        v = new l.SpeechRecognitionEventArgs(r,r.duration,r.resultId),
                        this.privDialogServiceConnector.recognized)
                            try {
                                this.privDialogServiceConnector.recognized(this.privDialogServiceConnector, v)
                            } catch (e) {}
                        n = !0;
                        break;
                    case "audio":
                        d = e.requestId.toUpperCase(),
                        y = this.privTurnStateManager.GetTurn(d);
                        try {
                            e.binaryBody ? y.audioStream.write(e.binaryBody) : y.endAudioStream()
                        } catch (e) {}
                        n = !0;
                        break;
                    case "response":
                        this.handleResponseMessage(e),
                        n = !0
                    }
                    return [2, n]
                }
                ))
            }
            ))
        }
        ,
        t.prototype.cancelRecognition = function(e, t, r, n, i) {
            return o(this, void 0, void 0, (function() {
                var t, o, a;
                return s(this, (function(s) {
                    switch (s.label) {
                    case 0:
                        return this.terminateMessageLoop = !0,
                        this.privRequestSession.isRecognizing ? [4, this.privRequestSession.onStopRecognizing()] : [3, 2];
                    case 1:
                        s.sent(),
                        s.label = 2;
                    case 2:
                        if (this.privDialogServiceConnector.canceled) {
                            (t = new l.PropertyCollection).setProperty(h.CancellationErrorCodePropertyName, l.CancellationErrorCode[n]),
                            o = new l.SpeechRecognitionCanceledEventArgs(r,i,n,void 0,e);
                            try {
                                this.privDialogServiceConnector.canceled(this.privDialogServiceConnector, o)
                            } catch (e) {}
                            if (this.privSuccessCallback) {
                                a = new l.SpeechRecognitionResult(void 0,l.ResultReason.Canceled,void 0,void 0,void 0,void 0,void 0,void 0,i,void 0,t);
                                try {
                                    this.privSuccessCallback(a),
                                    this.privSuccessCallback = void 0
                                } catch (e) {}
                            }
                        }
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.listenOnce = function(e, t, r) {
            return o(this, void 0, void 0, (function() {
                var n, i, c, u, p, f, h, v, d = this;
                return s(this, (function(y) {
                    switch (y.label) {
                    case 0:
                        return this.privRecognizerConfig.recognitionMode = e,
                        this.privSuccessCallback = t,
                        this.privErrorCallback = r,
                        this.privRequestSession.startNewRecognition(),
                        this.privRequestSession.listenForServiceTelemetry(this.privDialogAudioSource.events),
                        this.privRecognizerConfig.parameters.setProperty(l.PropertyId.Speech_SessionId, this.privRequestSession.sessionId),
                        n = this.connectImpl(),
                        i = this.sendPreAudioMessages(),
                        [4, this.privDialogAudioSource.attach(this.privRequestSession.audioNodeId)];
                    case 1:
                        return c = y.sent(),
                        [4, this.privDialogAudioSource.format];
                    case 2:
                        return u = y.sent(),
                        [4, this.privDialogAudioSource.deviceInfo];
                    case 3:
                        return p = y.sent(),
                        f = new a.ReplayableAudioNode(c,u.avgBytesPerSec),
                        [4, this.privRequestSession.onAudioSourceAttachCompleted(f, !1)];
                    case 4:
                        y.sent(),
                        this.privRecognizerConfig.SpeechServiceConfig.Context.audio = {
                            source: p
                        },
                        y.label = 5;
                    case 5:
                        return y.trys.push([5, 8, , 10]),
                        [4, n];
                    case 6:
                        return y.sent(),
                        [4, i];
                    case 7:
                        return y.sent(),
                        [3, 10];
                    case 8:
                        return h = y.sent(),
                        [4, this.cancelRecognition(this.privRequestSession.sessionId, this.privRequestSession.requestId, l.CancellationReason.Error, l.CancellationErrorCode.ConnectionFailure, h)];
                    case 9:
                        return y.sent(),
                        [2, Promise.resolve()];
                    case 10:
                        return v = new l.SessionEventArgs(this.privRequestSession.sessionId),
                        this.privRecognizer.sessionStarted && this.privRecognizer.sessionStarted(this.privRecognizer, v),
                        this.sendAudio(f).then((function() {}
                        ), (function(e) {
                            return o(d, void 0, void 0, (function() {
                                return s(this, (function(t) {
                                    switch (t.label) {
                                    case 0:
                                        return [4, this.cancelRecognition(this.privRequestSession.sessionId, this.privRequestSession.requestId, l.CancellationReason.Error, l.CancellationErrorCode.RuntimeError, e)];
                                    case 1:
                                        return t.sent(),
                                        [2]
                                    }
                                }
                                ))
                            }
                            ))
                        }
                        )),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.dialogConnectImpl = function(e) {
            return this.privConnectionLoop = this.startMessageLoop(),
            e
        }
        ,
        t.prototype.receiveDialogMessageOverride = function() {
            var e = this
              , t = new u.Deferred
              , r = function() {
                return o(e, void 0, void 0, (function() {
                    var e, n, i, o, a, c, p, f, v, y, g, m, b;
                    return s(this, (function(s) {
                        switch (s.label) {
                        case 0:
                            return s.trys.push([0, 12, , 13]),
                            e = this.isDisposed(),
                            n = !this.isDisposed() && this.terminateMessageLoop,
                            e || n ? (t.resolve(void 0),
                            [2]) : [4, this.fetchConnection()];
                        case 1:
                            return [4, s.sent().read()];
                        case 2:
                            if (!(i = s.sent()))
                                return [2, r()];
                            switch (o = d.SpeechConnectionMessage.fromConnectionMessage(i),
                            o.path.toLowerCase()) {
                            case "turn.start":
                                return [3, 3];
                            case "speech.startdetected":
                                return [3, 4];
                            case "speech.enddetected":
                                return [3, 5];
                            case "turn.end":
                                return [3, 6]
                            }
                            return [3, 10];
                        case 3:
                            return a = o.requestId.toUpperCase(),
                            m = this.privRequestSession.requestId.toUpperCase(),
                            a !== m ? this.privTurnStateManager.StartTurn(a) : this.privRequestSession.onServiceTurnStartResponse(),
                            [3, 11];
                        case 4:
                            return c = h.SpeechDetected.fromJSON(o.textBody),
                            p = new l.RecognitionEventArgs(c.Offset,this.privRequestSession.sessionId),
                            this.privRecognizer.speechStartDetected && this.privRecognizer.speechStartDetected(this.privRecognizer, p),
                            [3, 11];
                        case 5:
                            return f = void 0,
                            f = o.textBody.length > 0 ? o.textBody : "{ Offset: 0 }",
                            v = h.SpeechDetected.fromJSON(f),
                            this.privRequestSession.onServiceRecognized(v.Offset + this.privRequestSession.currentTurnAudioOffset),
                            y = new l.RecognitionEventArgs(v.Offset + this.privRequestSession.currentTurnAudioOffset,this.privRequestSession.sessionId),
                            this.privRecognizer.speechEndDetected && this.privRecognizer.speechEndDetected(this.privRecognizer, y),
                            [3, 11];
                        case 6:
                            return g = o.requestId.toUpperCase(),
                            m = this.privRequestSession.requestId.toUpperCase(),
                            g === m ? [3, 7] : (this.privTurnStateManager.CompleteTurn(g),
                            [3, 9]);
                        case 7:
                            return b = new l.SessionEventArgs(this.privRequestSession.sessionId),
                            [4, this.privRequestSession.onServiceTurnEndResponse(!1)];
                        case 8:
                            if (s.sent(),
                            this.privRecognizerConfig.isContinuousRecognition && !this.privRequestSession.isSpeechEnded && this.privRequestSession.isRecognizing || this.privRecognizer.sessionStopped && this.privRecognizer.sessionStopped(this.privRecognizer, b),
                            this.privSuccessCallback && this.privLastResult) {
                                try {
                                    this.privSuccessCallback(this.privLastResult),
                                    this.privLastResult = null
                                } catch (e) {
                                    this.privErrorCallback && this.privErrorCallback(e)
                                }
                                this.privSuccessCallback = void 0,
                                this.privErrorCallback = void 0
                            }
                            s.label = 9;
                        case 9:
                            return [3, 11];
                        case 10:
                            this.processTypeSpecificMessages(o) || this.serviceEvents && this.serviceEvents.onEvent(new u.ServiceEvent(o.path.toLowerCase(),o.textBody)),
                            s.label = 11;
                        case 11:
                            return [2, r()];
                        case 12:
                            return s.sent(),
                            this.terminateMessageLoop = !0,
                            t.resolve(),
                            [3, 13];
                        case 13:
                            return [2]
                        }
                    }
                    ))
                }
                ))
            };
            return r().catch((function(e) {
                u.Events.instance.onEvent(new u.BackgroundEvent(e))
            }
            )),
            t.promise
        }
        ,
        t.prototype.startMessageLoop = function() {
            return o(this, void 0, void 0, (function() {
                var e;
                return s(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        this.terminateMessageLoop = !1,
                        t.label = 1;
                    case 1:
                        return t.trys.push([1, 3, , 5]),
                        [4, this.receiveDialogMessageOverride()];
                    case 2:
                        return t.sent(),
                        [3, 5];
                    case 3:
                        return e = t.sent(),
                        [4, this.cancelRecognition(this.privRequestSession.sessionId, this.privRequestSession.requestId, l.CancellationReason.Error, l.CancellationErrorCode.RuntimeError, e)];
                    case 4:
                        return t.sent(),
                        [3, 5];
                    case 5:
                        return [2, Promise.resolve()]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.configConnection = function(e) {
            return o(this, void 0, void 0, (function() {
                return s(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return this.terminateMessageLoop ? (this.terminateMessageLoop = !1,
                        [2, Promise.reject("Connection to service terminated.")]) : [4, this.sendSpeechServiceConfig(e, this.privRequestSession, this.privRecognizerConfig.SpeechServiceConfig.serialize())];
                    case 1:
                        return t.sent(),
                        [4, this.sendAgentConfig(e)];
                    case 2:
                        return t.sent(),
                        [2, e]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.sendPreAudioMessages = function() {
            return o(this, void 0, void 0, (function() {
                var e;
                return s(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return [4, this.fetchConnection()];
                    case 1:
                        return e = t.sent(),
                        this.addKeywordContextData(),
                        [4, this.sendSpeechContext(e)];
                    case 2:
                        return t.sent(),
                        [4, this.sendAgentContext(e)];
                    case 3:
                        return t.sent(),
                        [4, this.sendWaveHeader(e)];
                    case 4:
                        return t.sent(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.fireEventForResult = function(e, t) {
            var r = h.EnumTranslation.implTranslateRecognitionResult(e.RecognitionStatus)
              , n = e.Offset + this.privRequestSession.currentTurnAudioOffset
              , i = new l.SpeechRecognitionResult(this.privRequestSession.requestId,r,e.DisplayText,e.Duration,n,e.Language,e.LanguageDetectionConfidence,void 0,void 0,JSON.stringify(e),t);
            return new l.SpeechRecognitionEventArgs(i,n,this.privRequestSession.sessionId)
        }
        ,
        t.prototype.onEvent = function(e) {
            this.privEvents.onEvent(e),
            u.Events.instance.onEvent(e)
        }
        ,
        t.prototype.addKeywordContextData = function() {
            var e = this.privRecognizerConfig.parameters.getProperty("SPEECH-KeywordsToDetect");
            if (void 0 !== e) {
                for (var t = this.privRecognizerConfig.parameters.getProperty("SPEECH-KeywordsToDetect-Offsets"), r = this.privRecognizerConfig.parameters.getProperty("SPEECH-KeywordsToDetect-Durations"), n = e.split(";"), i = void 0 === t ? [] : t.split(";"), o = void 0 === r ? [] : r.split(";"), s = [], a = 0; a < n.length; a++) {
                    var c = {};
                    c.text = n[a],
                    a < i.length && (c.offset = Number(i[a])),
                    a < o.length && (c.duration = Number(o[a])),
                    s.push(c)
                }
                this.speechContext.setSection("invocationSource", "VoiceActivationWithKeyword"),
                this.speechContext.setSection("keywordDetection", [{
                    clientDetectedKeywords: s,
                    onReject: {
                        action: "EndOfTurn"
                    },
                    type: "startTrigger"
                }])
            }
        }
        ,
        t
    }(h.ServiceRecognizerBase);
    t.DialogServiceAdapter = y
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.DialogServiceTurnStateManager = void 0;
    var n = r(25)
      , i = r(201)
      , o = function() {
        function e() {
            this.privTurnMap = new Map
        }
        return e.prototype.StartTurn = function(e) {
            if (this.privTurnMap.has(e))
                throw new n.InvalidOperationError("Service error: There is already a turn with id:" + e);
            var t = new i.DialogServiceTurnState(this,e);
            return this.privTurnMap.set(e, t),
            this.privTurnMap.get(e)
        }
        ,
        e.prototype.GetTurn = function(e) {
            return this.privTurnMap.get(e)
        }
        ,
        e.prototype.CompleteTurn = function(e) {
            if (!this.privTurnMap.has(e))
                throw new n.InvalidOperationError("Service error: Received turn end for an unknown turn id:" + e);
            var t = this.privTurnMap.get(e);
            return t.complete(),
            this.privTurnMap.delete(e),
            t
        }
        ,
        e
    }();
    t.DialogServiceTurnStateManager = o
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.DialogServiceTurnState = void 0;
    var n = r(74)
      , i = r(73)
      , o = r(202)
      , s = function() {
        function e(e, t) {
            this.privRequestId = t,
            this.privIsCompleted = !1,
            this.privAudioStream = null,
            this.privTurnManager = e,
            this.resetTurnEndTimeout()
        }
        return Object.defineProperty(e.prototype, "audioStream", {
            get: function() {
                return this.resetTurnEndTimeout(),
                this.privAudioStream
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.processActivityPayload = function(e, t) {
            return e.messageDataStreamType === o.MessageDataStreamType.TextToSpeechAudio && (this.privAudioStream = i.AudioOutputStream.createPullStream(),
            this.privAudioStream.format = void 0 !== t ? t : n.AudioOutputFormatImpl.getDefaultOutputFormat()),
            this.privAudioStream
        }
        ,
        e.prototype.endAudioStream = function() {
            null === this.privAudioStream || this.privAudioStream.isClosed || this.privAudioStream.close()
        }
        ,
        e.prototype.complete = function() {
            void 0 !== this.privTimeoutToken && clearTimeout(this.privTimeoutToken),
            this.endAudioStream()
        }
        ,
        e.prototype.resetTurnEndTimeout = function() {
            var e = this;
            void 0 !== this.privTimeoutToken && clearTimeout(this.privTimeoutToken),
            this.privTimeoutToken = setTimeout((function() {
                e.privTurnManager.CompleteTurn(e.privRequestId)
            }
            ), 2e3)
        }
        ,
        e
    }();
    t.DialogServiceTurnState = s
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.MessageDataStreamType = t.ActivityPayloadResponse = void 0;
    var n = function() {
        function e(e) {
            this.privActivityResponse = JSON.parse(e)
        }
        return e.fromJSON = function(t) {
            return new e(t)
        }
        ,
        Object.defineProperty(e.prototype, "conversationId", {
            get: function() {
                return this.privActivityResponse.conversationId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "messageDataStreamType", {
            get: function() {
                return this.privActivityResponse.messageDataStreamType
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "messagePayload", {
            get: function() {
                return this.privActivityResponse.messagePayload
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "version", {
            get: function() {
                return this.privActivityResponse.version
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.ActivityPayloadResponse = n,
    function(e) {
        e[e.None = 0] = "None",
        e[e.TextToSpeechAudio = 1] = "TextToSpeechAudio"
    }(t.MessageDataStreamType || (t.MessageDataStreamType = {}))
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.AgentConfig = void 0;
    var n = function() {
        function e() {}
        return e.prototype.toJsonString = function() {
            return JSON.stringify(this.iPrivConfig)
        }
        ,
        e.prototype.get = function() {
            return this.iPrivConfig
        }
        ,
        e.prototype.set = function(e) {
            this.iPrivConfig = e
        }
        ,
        e
    }();
    t.AgentConfig = n
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    });
    var n = r(205);
    Object.defineProperty(t, "ConversationManager", {
        enumerable: !0,
        get: function() {
            return n.ConversationManager
        }
    });
    var i = r(206);
    Object.defineProperty(t, "ConversationConnectionConfig", {
        enumerable: !0,
        get: function() {
            return i.ConversationConnectionConfig
        }
    });
    var o = r(208);
    Object.defineProperty(t, "ConversationRecognizerFactory", {
        enumerable: !0,
        get: function() {
            return o.ConversationRecognizerFactory
        }
    });
    var s = r(220);
    Object.defineProperty(t, "TranscriberRecognizer", {
        enumerable: !0,
        get: function() {
            return s.TranscriberRecognizer
        }
    });
    var a = r(214);
    Object.defineProperty(t, "ConversationReceivedTranslationEventArgs", {
        enumerable: !0,
        get: function() {
            return a.ConversationReceivedTranslationEventArgs
        }
    }),
    Object.defineProperty(t, "LockRoomEventArgs", {
        enumerable: !0,
        get: function() {
            return a.LockRoomEventArgs
        }
    }),
    Object.defineProperty(t, "MuteAllEventArgs", {
        enumerable: !0,
        get: function() {
            return a.MuteAllEventArgs
        }
    }),
    Object.defineProperty(t, "ParticipantAttributeEventArgs", {
        enumerable: !0,
        get: function() {
            return a.ParticipantAttributeEventArgs
        }
    }),
    Object.defineProperty(t, "ParticipantEventArgs", {
        enumerable: !0,
        get: function() {
            return a.ParticipantEventArgs
        }
    }),
    Object.defineProperty(t, "ParticipantsListEventArgs", {
        enumerable: !0,
        get: function() {
            return a.ParticipantsListEventArgs
        }
    });
    var c = r(215);
    Object.defineProperty(t, "ConversationTranslatorCommandTypes", {
        enumerable: !0,
        get: function() {
            return c.ConversationTranslatorCommandTypes
        }
    }),
    Object.defineProperty(t, "ConversationTranslatorMessageTypes", {
        enumerable: !0,
        get: function() {
            return c.ConversationTranslatorMessageTypes
        }
    }),
    Object.defineProperty(t, "InternalParticipants", {
        enumerable: !0,
        get: function() {
            return c.InternalParticipants
        }
    })
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConversationManager = void 0;
    var n = r(2)
      , i = r(63)
      , o = r(61)
      , s = r(206)
      , a = function() {
        function e() {
            this.privRequestParams = s.ConversationConnectionConfig.configParams,
            this.privErrors = s.ConversationConnectionConfig.restErrors,
            this.privHost = s.ConversationConnectionConfig.host,
            this.privApiVersion = s.ConversationConnectionConfig.apiVersion,
            this.privRestPath = s.ConversationConnectionConfig.restPath,
            this.privRestAdapter = new n.RestMessageAdapter({})
        }
        return e.prototype.createOrJoin = function(e, t, r, a) {
            var c = this;
            try {
                i.Contracts.throwIfNullOrUndefined(e, "args");
                var u = e.getProperty(o.PropertyId.SpeechServiceConnection_RecoLanguage, s.ConversationConnectionConfig.defaultLanguageCode)
                  , p = e.getProperty(o.PropertyId.ConversationTranslator_Name, "conversation_host")
                  , l = e.getProperty(o.PropertyId.ConversationTranslator_Host, this.privHost)
                  , f = e.getProperty(o.PropertyId.ConversationTranslator_CorrelationId)
                  , h = e.getProperty(o.PropertyId.SpeechServiceConnection_Key)
                  , v = e.getProperty(o.PropertyId.SpeechServiceConnection_Region)
                  , d = e.getProperty(o.PropertyId.SpeechServiceAuthorization_Token);
                i.Contracts.throwIfNullOrWhitespace(u, "languageCode"),
                i.Contracts.throwIfNullOrWhitespace(p, "nickname"),
                i.Contracts.throwIfNullOrWhitespace(l, "endpointHost");
                var y = {};
                y[this.privRequestParams.apiVersion] = this.privApiVersion,
                y[this.privRequestParams.languageCode] = u,
                y[this.privRequestParams.nickname] = p;
                var g = {};
                f && (g[this.privRequestParams.correlationId] = f),
                g[this.privRequestParams.clientAppId] = s.ConversationConnectionConfig.clientAppId,
                void 0 !== t ? y[this.privRequestParams.roomId] = t : (i.Contracts.throwIfNullOrUndefined(v, this.privErrors.authInvalidSubscriptionRegion),
                g[this.privRequestParams.subscriptionRegion] = v,
                h ? g[this.privRequestParams.subscriptionKey] = h : d ? g[this.privRequestParams.authorization] = "Bearer " + d : i.Contracts.throwIfNullOrUndefined(h, this.privErrors.authInvalidSubscriptionKey));
                var m = {};
                m.headers = g,
                this.privRestAdapter.options = m;
                var b = "https://" + l + this.privRestPath;
                this.privRestAdapter.request(n.RestRequestType.Post, b, y, null).then((function(e) {
                    var t = n.RestMessageAdapter.extractHeaderValue(c.privRequestParams.requestId, e.headers);
                    if (e.ok) {
                        var i = JSON.parse(e.data);
                        if (i && (i.requestId = t),
                        r) {
                            try {
                                r(i)
                            } catch (e) {
                                a && a(e)
                            }
                            r = void 0
                        }
                    } else if (a) {
                        var o = c.privErrors.invalidCreateJoinConversationResponse.replace("{status}", e.status.toString())
                          , s = void 0;
                        try {
                            o += " [" + (s = JSON.parse(e.data)).error.code + ": " + s.error.message + "]"
                        } catch (t) {
                            o += " [" + e.data + "]"
                        }
                        t && (o += " " + t),
                        a(o)
                    }
                }
                )).catch((function(e) {}
                ))
            } catch (e) {
                if (a)
                    if (e instanceof Error) {
                        var S = e;
                        a(S.name + ": " + S.message)
                    } else
                        a(e)
            }
        }
        ,
        e.prototype.leave = function(e, t) {
            var r = this;
            return new Promise((function(s, a) {
                try {
                    i.Contracts.throwIfNullOrUndefined(e, r.privErrors.invalidArgs.replace("{arg}", "config")),
                    i.Contracts.throwIfNullOrWhitespace(t, r.privErrors.invalidArgs.replace("{arg}", "token"));
                    var c = e.getProperty(o.PropertyId.ConversationTranslator_Host, r.privHost)
                      , u = e.getProperty(o.PropertyId.ConversationTranslator_CorrelationId)
                      , p = {};
                    p[r.privRequestParams.apiVersion] = r.privApiVersion,
                    p[r.privRequestParams.sessionToken] = t;
                    var l = {};
                    u && (l[r.privRequestParams.correlationId] = u);
                    var f = {};
                    f.headers = l,
                    r.privRestAdapter.options = f;
                    var h = "https://" + c + r.privRestPath;
                    r.privRestAdapter.request(n.RestRequestType.Delete, h, p, null).then((function(e) {
                        e.ok,
                        s()
                    }
                    )).catch((function(e) {}
                    ))
                } catch (e) {
                    if (e instanceof Error) {
                        var v = e;
                        a(v.name + ": " + v.message)
                    } else
                        a(e)
                }
            }
            ))
        }
        ,
        e
    }();
    t.ConversationManager = a
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConversationConnectionConfig = void 0;
    var o = function(e) {
        function t() {
            return null !== e && e.apply(this, arguments) || this
        }
        return i(t, e),
        Object.defineProperty(t, "host", {
            get: function() {
                return t.privHost
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t, "apiVersion", {
            get: function() {
                return t.privApiVersion
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t, "clientAppId", {
            get: function() {
                return t.privClientAppId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t, "defaultLanguageCode", {
            get: function() {
                return t.privDefaultLanguageCode
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t, "restPath", {
            get: function() {
                return t.privRestPath
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t, "webSocketPath", {
            get: function() {
                return t.privWebSocketPath
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t, "speechHost", {
            get: function() {
                return t.privSpeechHost
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t, "speechPath", {
            get: function() {
                return t.privSpeechPath
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t, "transcriptionEventKeys", {
            get: function() {
                return t.privTranscriptionEventKeys
            },
            enumerable: !1,
            configurable: !0
        }),
        t.privHost = "dev.microsofttranslator.com",
        t.privRestPath = "/capito/room",
        t.privApiVersion = "2.0",
        t.privDefaultLanguageCode = "en-US",
        t.privClientAppId = "FC539C22-1767-4F1F-84BC-B4D811114F15",
        t.privWebSocketPath = "/capito/translate",
        t.privSpeechHost = "{region}.s2s.speech.microsoft.com",
        t.privSpeechPath = "/speech/translation/cognitiveservices/v1",
        t.privTranscriptionEventKeys = ["iCalUid", "callId", "organizer", "FLAC", "MTUri", "DifferentiateGuestSpeakers", "audiorecording", "Threadid", "OrganizerMri", "OrganizerTenantId", "UserToken"],
        t
    }(r(207).RestConfigBase);
    t.ConversationConnectionConfig = o
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.RestConfigBase = void 0;
    var n = function() {
        function e() {}
        return Object.defineProperty(e, "requestOptions", {
            get: function() {
                return e.privDefaultRequestOptions
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e, "configParams", {
            get: function() {
                return e.privDefaultParams
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e, "restErrors", {
            get: function() {
                return e.privRestErrors
            },
            enumerable: !1,
            configurable: !0
        }),
        e.privDefaultRequestOptions = {
            headers: {
                Accept: "application/json"
            },
            ignoreCache: !1,
            timeout: 1e4
        },
        e.privRestErrors = {
            authInvalidSubscriptionKey: "You must specify either an authentication token to use, or a Cognitive Speech subscription key.",
            authInvalidSubscriptionRegion: "You must specify the Cognitive Speech region to use.",
            invalidArgs: "Required input not found: {arg}.",
            invalidCreateJoinConversationResponse: "Creating/Joining conversation failed with HTTP {status}.",
            invalidParticipantRequest: "The requested participant was not found.",
            permissionDeniedConnect: "Required credentials not found.",
            permissionDeniedConversation: "Invalid operation: only the host can {command} the conversation.",
            permissionDeniedParticipant: "Invalid operation: only the host can {command} a participant.",
            permissionDeniedSend: "Invalid operation: the conversation is not in a connected state.",
            permissionDeniedStart: "Invalid operation: there is already an active conversation."
        },
        e.privDefaultParams = {
            apiVersion: "api-version",
            authorization: "Authorization",
            clientAppId: "X-ClientAppId",
            contentTypeKey: "Content-Type",
            correlationId: "X-CorrelationId",
            languageCode: "language",
            nickname: "nickname",
            profanity: "profanity",
            requestId: "X-RequestId",
            roomId: "roomid",
            sessionToken: "token",
            subscriptionKey: "Ocp-Apim-Subscription-Key",
            subscriptionRegion: "Ocp-Apim-Subscription-Region",
            token: "X-CapitoToken"
        },
        e
    }();
    t.RestConfigBase = n
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    ), o = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
    , s = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConversationTranslatorRecognizer = t.ConversationRecognizerFactory = void 0;
    var a = r(53)
      , c = r(4)
      , u = r(63)
      , p = r(61)
      , l = r(209)
      , f = r(212)
      , h = function() {
        function e() {}
        return e.fromConfig = function(e, t, r) {
            return new v(e,t,r)
        }
        ,
        e
    }();
    t.ConversationRecognizerFactory = h;
    var v = function(e) {
        function t(t, r, n) {
            var i = this
              , o = r;
            u.Contracts.throwIfNull(o, "speechConfig");
            var s = t;
            return u.Contracts.throwIfNull(s, "conversationImpl"),
            (i = e.call(this, n, o.properties, new l.ConversationConnectionFactory) || this).privConversation = s,
            i.privIsDisposed = !1,
            i.privProperties = o.properties.clone(),
            i.privConnection = p.Connection.fromRecognizer(i),
            i.privSetTimeout = "undefined" != typeof Blob && "undefined" != typeof Worker ? c.Timeout.setTimeout : setTimeout,
            i.privClearTimeout = "undefined" != typeof Blob && "undefined" != typeof Worker ? c.Timeout.clearTimeout : clearTimeout,
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "connected", {
            set: function(e) {
                this.privConnection.connected = e
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "disconnected", {
            set: function(e) {
                this.privConnection.disconnected = e
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "speechRecognitionLanguage", {
            get: function() {
                return this.privSpeechRecognitionLanguage
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.isDisposed = function() {
            return this.privIsDisposed
        }
        ,
        t.prototype.connect = function(e, t, r) {
            try {
                u.Contracts.throwIfDisposed(this.privIsDisposed),
                u.Contracts.throwIfNullOrWhitespace(e, "token"),
                this.privReco.conversationTranslatorToken = e,
                this.resetConversationTimeout(),
                this.privReco.connectAsync(t, r)
            } catch (e) {
                if (r)
                    if (e instanceof Error) {
                        var n = e;
                        r(n.name + ": " + n.message)
                    } else
                        r(e)
            }
        }
        ,
        t.prototype.disconnect = function(e, t) {
            try {
                u.Contracts.throwIfDisposed(this.privIsDisposed),
                void 0 !== this.privTimeoutToken && this.privClearTimeout(this.privTimeoutToken),
                this.privReco.disconnect().then((function() {
                    e && e()
                }
                ), (function(e) {
                    t && t(e)
                }
                ))
            } catch (e) {
                if (t)
                    if (e instanceof Error) {
                        var r = e;
                        t(r.name + ": " + r.message)
                    } else
                        t(e);
                this.dispose(!0).catch((function(e) {
                    c.Events.instance.onEvent(new c.BackgroundEvent(e))
                }
                ))
            }
        }
        ,
        t.prototype.sendRequest = function(e, t, r) {
            try {
                u.Contracts.throwIfDisposed(this.privIsDisposed),
                this.sendMessage(e, t, r)
            } catch (e) {
                if (r)
                    if (e instanceof Error) {
                        var n = e;
                        r(n.name + ": " + n.message)
                    } else
                        r(e);
                this.dispose(!0).catch((function(e) {
                    c.Events.instance.onEvent(new c.BackgroundEvent(e))
                }
                ))
            }
        }
        ,
        t.prototype.close = function() {
            var e, t;
            return o(this, void 0, void 0, (function() {
                return s(this, (function(r) {
                    switch (r.label) {
                    case 0:
                        return this.privIsDisposed ? [3, 2] : (null === (e = this.privConnection) || void 0 === e || e.closeConnection(),
                        null === (t = this.privConnection) || void 0 === t || t.close(),
                        this.privConnection = void 0,
                        [4, this.dispose(!0)]);
                    case 1:
                        r.sent(),
                        r.label = 2;
                    case 2:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.dispose = function(t) {
            return o(this, void 0, void 0, (function() {
                return s(this, (function(r) {
                    switch (r.label) {
                    case 0:
                        return this.privIsDisposed ? [2] : t ? (void 0 !== this.privTimeoutToken && this.privClearTimeout(this.privTimeoutToken),
                        this.privIsDisposed = !0,
                        this.privConnection && (this.privConnection.closeConnection(),
                        this.privConnection.close(),
                        this.privConnection = void 0),
                        [4, e.prototype.dispose.call(this, t)]) : [3, 2];
                    case 1:
                        r.sent(),
                        r.label = 2;
                    case 2:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.createRecognizerConfig = function(e) {
            return new a.RecognizerConfig(e,this.privProperties)
        }
        ,
        t.prototype.createServiceRecognizer = function(e, t, r, n) {
            var i = r;
            return new f.ConversationServiceAdapter(e,t,i,n,this)
        }
        ,
        t.prototype.sendMessage = function(e, t, r) {
            !function(e, t, r) {
                e ? e.then((function(e) {
                    try {
                        t && t()
                    } catch (e) {
                        r && r("'Unhandled error on promise callback: " + e + "'")
                    }
                }
                ), (function(e) {
                    try {
                        r && r(e)
                    } catch (e) {}
                }
                )) : r && r("Null promise")
            }(this.privReco.sendMessageAsync(e), t, r),
            this.resetConversationTimeout()
        }
        ,
        t.prototype.resetConversationTimeout = function() {
            var e = this;
            void 0 !== this.privTimeoutToken && this.privClearTimeout(this.privTimeoutToken),
            this.privTimeoutToken = this.privSetTimeout((function() {
                e.sendRequest(e.privConversation.getKeepAlive())
            }
            ), 6e4)
        }
        ,
        t
    }(p.Recognizer);
    t.ConversationTranslatorRecognizer = v
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConversationConnectionFactory = void 0;
    var o = r(2)
      , s = r(4)
      , a = r(63)
      , c = r(61)
      , u = r(123)
      , p = r(206)
      , l = r(210)
      , f = function(e) {
        function t() {
            return null !== e && e.apply(this, arguments) || this
        }
        return i(t, e),
        t.prototype.create = function(e, t, r) {
            var n = e.parameters.getProperty(c.PropertyId.ConversationTranslator_Host, p.ConversationConnectionConfig.host)
              , i = e.parameters.getProperty(c.PropertyId.ConversationTranslator_CorrelationId, s.createGuid())
              , u = "wss://" + n + p.ConversationConnectionConfig.webSocketPath
              , f = e.parameters.getProperty(c.PropertyId.ConversationTranslator_Token, void 0);
            a.Contracts.throwIfNullOrUndefined(f, "token");
            var h = {};
            h[p.ConversationConnectionConfig.configParams.apiVersion] = p.ConversationConnectionConfig.apiVersion,
            h[p.ConversationConnectionConfig.configParams.token] = f,
            h[p.ConversationConnectionConfig.configParams.correlationId] = i;
            var v = "true" === e.parameters.getProperty("SPEECH-EnableWebsocketCompression", "false");
            return new o.WebsocketConnection(u,h,{},new l.ConversationWebsocketMessageFormatter,o.ProxyInfo.fromRecognizerConfig(e),v,r)
        }
        ,
        t
    }(u.ConnectionFactoryBase);
    t.ConversationConnectionFactory = f
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConversationWebsocketMessageFormatter = void 0;
    var n = r(4)
      , i = r(211)
      , o = function() {
        this.toConnectionMessage = function(e) {
            var t = new n.Deferred;
            try {
                if (e.messageType === n.MessageType.Text) {
                    var r = new i.ConversationConnectionMessage(e.messageType,e.textContent,{},e.id);
                    t.resolve(r)
                } else
                    e.messageType === n.MessageType.Binary && t.resolve(new i.ConversationConnectionMessage(e.messageType,e.binaryContent,void 0,e.id))
            } catch (e) {
                t.reject("Error formatting the message. Error: " + e)
            }
            return t.promise
        }
        ,
        this.fromConnectionMessage = function(e) {
            var t = new n.Deferred;
            try {
                if (e.messageType === n.MessageType.Text) {
                    var r = "" + (e.textBody ? e.textBody : "");
                    t.resolve(new n.RawWebsocketMessage(n.MessageType.Text,r,e.id))
                }
            } catch (e) {
                t.reject("Error formatting the message. " + e)
            }
            return t.promise
        }
    };
    t.ConversationWebsocketMessageFormatter = o
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConversationConnectionMessage = void 0;
    var o = function(e) {
        function t(t, r, n, i) {
            var o = e.call(this, t, r, n, i) || this
              , s = JSON.parse(o.textBody);
            return void 0 !== s.type && (o.privConversationMessageType = s.type),
            o
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "conversationMessageType", {
            get: function() {
                return this.privConversationMessageType
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(r(4).ConnectionMessage);
    t.ConversationConnectionMessage = o
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    ), o = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
    , s = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConversationServiceAdapter = void 0;
    var a = r(4)
      , c = r(61)
      , u = r(53)
      , p = r(211)
      , l = r(213)
      , f = r(214)
      , h = r(215)
      , v = r(216)
      , d = function(e) {
        function t(t, r, n, i, o) {
            var s = e.call(this, t, r, n, i, o) || this;
            return s.privLastPartialUtteranceId = "",
            s.noOp = function() {}
            ,
            s.privConversationServiceConnector = o,
            s.privConversationAuthentication = t,
            s.receiveMessageOverride = s.receiveConversationMessageOverride,
            s.recognizeOverride = s.noOp,
            s.postConnectImplOverride = s.conversationConnectImpl,
            s.configConnectionOverride = s.configConnection,
            s.disconnectOverride = s.privDisconnect,
            s.privConversationRequestSession = new l.ConversationRequestSession(a.createNoDashGuid()),
            s.privConversationConnectionFactory = r,
            s.privConversationIsDisposed = !1,
            s
        }
        return i(t, e),
        t.prototype.isDisposed = function() {
            return e.prototype.isDisposed.call(this) || this.privConversationIsDisposed
        }
        ,
        t.prototype.dispose = function(t) {
            return o(this, void 0, void 0, (function() {
                return s(this, (function(r) {
                    switch (r.label) {
                    case 0:
                        return this.privConversationIsDisposed = !0,
                        this.privConnectionConfigPromise ? [4, this.privConnectionConfigPromise] : [3, 3];
                    case 1:
                        return [4, r.sent().dispose(t)];
                    case 2:
                        r.sent(),
                        r.label = 3;
                    case 3:
                        return [4, e.prototype.dispose.call(this, t)];
                    case 4:
                        return r.sent(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.sendMessage = function(e) {
            return o(this, void 0, void 0, (function() {
                return s(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return [4, this.fetchConnection()];
                    case 1:
                        return [2, t.sent().send(new p.ConversationConnectionMessage(a.MessageType.Text,e))]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.sendMessageAsync = function(e) {
            return o(this, void 0, void 0, (function() {
                return s(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return new a.Deferred,
                        [4, this.fetchConnection()];
                    case 1:
                        return [4, t.sent().send(new p.ConversationConnectionMessage(a.MessageType.Text,e))];
                    case 2:
                        return t.sent(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.privDisconnect = function() {
            if (!this.terminateMessageLoop)
                return this.cancelRecognition(this.privConversationRequestSession.sessionId, this.privConversationRequestSession.requestId, c.CancellationReason.Error, c.CancellationErrorCode.NoError, "Disconnecting"),
                this.terminateMessageLoop = !0,
                Promise.resolve()
        }
        ,
        t.prototype.processTypeSpecificMessages = function(e, t, r) {
            return o(this, void 0, void 0, (function() {
                return s(this, (function(e) {
                    return [2, !0]
                }
                ))
            }
            ))
        }
        ,
        t.prototype.cancelRecognition = function(e, t, r, n, i) {
            this.terminateMessageLoop = !0;
            var o = new c.ConversationTranslationCanceledEventArgs(r,i,n,void 0,e);
            try {
                this.privConversationServiceConnector.canceled && this.privConversationServiceConnector.canceled(this.privConversationServiceConnector, o)
            } catch (e) {}
        }
        ,
        t.prototype.conversationConnectImpl = function(e) {
            return o(this, void 0, void 0, (function() {
                return s(this, (function(t) {
                    return this.privConnectionLoop = this.startMessageLoop(),
                    [2, e]
                }
                ))
            }
            ))
        }
        ,
        t.prototype.receiveConversationMessageOverride = function() {
            return o(this, void 0, void 0, (function() {
                var e, t, r, n, i, o, p, l, d, y, g, m, b, S, C;
                return s(this, (function(s) {
                    switch (s.label) {
                    case 0:
                        if (this.isDisposed() || this.terminateMessageLoop)
                            return [2, Promise.resolve()];
                        e = new a.Deferred,
                        s.label = 1;
                    case 1:
                        return s.trys.push([1, 4, , 5]),
                        [4, this.fetchConnection()];
                    case 2:
                        return [4, s.sent().read()];
                    case 3:
                        if (t = s.sent(),
                        this.isDisposed() || this.terminateMessageLoop)
                            return e.resolve(),
                            [2, Promise.resolve()];
                        if (!t)
                            return [2, this.receiveConversationMessageOverride()];
                        r = this.privConversationRequestSession.sessionId,
                        n = !1;
                        try {
                            switch (t.conversationMessageType.toLowerCase()) {
                            case "info":
                            case "participant_command":
                            case "command":
                                switch ((i = v.CommandResponsePayload.fromJSON(t.textBody)).command.toLowerCase()) {
                                case "participantlist":
                                    o = v.ParticipantsListPayloadResponse.fromJSON(t.textBody),
                                    p = o.participants.map((function(e) {
                                        return {
                                            avatar: e.avatar,
                                            displayName: e.nickname,
                                            id: e.participantId,
                                            isHost: e.ishost,
                                            isMuted: e.ismuted,
                                            isUsingTts: e.usetts,
                                            preferredLanguage: e.locale
                                        }
                                    }
                                    )),
                                    this.privConversationServiceConnector.participantsListReceived && this.privConversationServiceConnector.participantsListReceived(this.privConversationServiceConnector, new f.ParticipantsListEventArgs(o.roomid,o.token,o.translateTo,o.profanityFilter,o.roomProfanityFilter,o.roomLocked,o.muteAll,p,r));
                                    break;
                                case "settranslatetolanguages":
                                    this.privConversationServiceConnector.participantUpdateCommandReceived && this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector, new f.ParticipantAttributeEventArgs(i.participantId,h.ConversationTranslatorCommandTypes.setTranslateToLanguages,i.value,r));
                                    break;
                                case "setprofanityfiltering":
                                    this.privConversationServiceConnector.participantUpdateCommandReceived && this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector, new f.ParticipantAttributeEventArgs(i.participantId,h.ConversationTranslatorCommandTypes.setProfanityFiltering,i.value,r));
                                    break;
                                case "setmute":
                                    this.privConversationServiceConnector.participantUpdateCommandReceived && this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector, new f.ParticipantAttributeEventArgs(i.participantId,h.ConversationTranslatorCommandTypes.setMute,i.value,r));
                                    break;
                                case "setmuteall":
                                    this.privConversationServiceConnector.muteAllCommandReceived && this.privConversationServiceConnector.muteAllCommandReceived(this.privConversationServiceConnector, new f.MuteAllEventArgs(i.value,r));
                                    break;
                                case "roomexpirationwarning":
                                    this.privConversationServiceConnector.conversationExpiration && this.privConversationServiceConnector.conversationExpiration(this.privConversationServiceConnector, new c.ConversationExpirationEventArgs(i.value,this.privConversationRequestSession.sessionId));
                                    break;
                                case "setusetts":
                                    this.privConversationServiceConnector.participantUpdateCommandReceived && this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector, new f.ParticipantAttributeEventArgs(i.participantId,h.ConversationTranslatorCommandTypes.setUseTTS,i.value,r));
                                    break;
                                case "setlockstate":
                                    this.privConversationServiceConnector.lockRoomCommandReceived && this.privConversationServiceConnector.lockRoomCommandReceived(this.privConversationServiceConnector, new f.LockRoomEventArgs(i.value,r));
                                    break;
                                case "changenickname":
                                    this.privConversationServiceConnector.participantUpdateCommandReceived && this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector, new f.ParticipantAttributeEventArgs(i.participantId,h.ConversationTranslatorCommandTypes.changeNickname,i.nickname,r));
                                    break;
                                case "joinsession":
                                    l = v.ParticipantPayloadResponse.fromJSON(t.textBody),
                                    d = {
                                        avatar: l.avatar,
                                        displayName: l.nickname,
                                        id: l.participantId,
                                        isHost: l.ishost,
                                        isMuted: l.ismuted,
                                        isUsingTts: l.usetts,
                                        preferredLanguage: l.locale
                                    },
                                    this.privConversationServiceConnector.participantJoinCommandReceived && this.privConversationServiceConnector.participantJoinCommandReceived(this.privConversationServiceConnector, new f.ParticipantEventArgs(d,r));
                                    break;
                                case "leavesession":
                                    y = {
                                        id: i.participantId
                                    },
                                    this.privConversationServiceConnector.participantLeaveCommandReceived && this.privConversationServiceConnector.participantLeaveCommandReceived(this.privConversationServiceConnector, new f.ParticipantEventArgs(y,r));
                                    break;
                                case "disconnectsession":
                                    ({
                                        id: i.participantId
                                    });
                                    break;
                                case "token":
                                    g = new u.CognitiveTokenAuthentication((function(e) {
                                        var t = i.token;
                                        return Promise.resolve(t)
                                    }
                                    ),(function(e) {
                                        var t = i.token;
                                        return Promise.resolve(t)
                                    }
                                    )),
                                    this.authentication = g
                                }
                                break;
                            case "partial":
                            case "final":
                                m = v.SpeechResponsePayload.fromJSON(t.textBody),
                                b = new c.ConversationTranslationResult(m.participantId,this.getTranslations(m.translations),m.language,void 0,void 0,m.recognition,void 0,void 0,t.textBody,void 0),
                                m.isFinal ? ((void 0 !== b.text && b.text.length > 0 || m.id === this.privLastPartialUtteranceId) && (n = !0),
                                n && this.privConversationServiceConnector.translationReceived && this.privConversationServiceConnector.translationReceived(this.privConversationServiceConnector, new f.ConversationReceivedTranslationEventArgs(h.ConversationTranslatorMessageTypes.final,b,r))) : void 0 !== b.text && (this.privLastPartialUtteranceId = m.id,
                                this.privConversationServiceConnector.translationReceived && this.privConversationServiceConnector.translationReceived(this.privConversationServiceConnector, new f.ConversationReceivedTranslationEventArgs(h.ConversationTranslatorMessageTypes.partial,b,r)));
                                break;
                            case "translated_message":
                                S = v.TextResponsePayload.fromJSON(t.textBody),
                                C = new c.ConversationTranslationResult(S.participantId,this.getTranslations(S.translations),S.language,void 0,void 0,S.originalText,void 0,void 0,void 0,t.textBody,void 0),
                                this.privConversationServiceConnector.translationReceived && this.privConversationServiceConnector.translationReceived(this.privConversationServiceConnector, new f.ConversationReceivedTranslationEventArgs(h.ConversationTranslatorMessageTypes.instantMessage,C,r))
                            }
                        } catch (e) {}
                        return [2, this.receiveConversationMessageOverride()];
                    case 4:
                        return s.sent(),
                        this.terminateMessageLoop = !0,
                        [3, 5];
                    case 5:
                        return [2, e.promise]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.startMessageLoop = function() {
            return o(this, void 0, void 0, (function() {
                var e, t;
                return s(this, (function(r) {
                    switch (r.label) {
                    case 0:
                        if (this.isDisposed())
                            return [2, Promise.resolve()];
                        this.terminateMessageLoop = !1,
                        e = this.receiveConversationMessageOverride(),
                        r.label = 1;
                    case 1:
                        return r.trys.push([1, 3, , 4]),
                        [4, e];
                    case 2:
                        return [2, r.sent()];
                    case 3:
                        return t = r.sent(),
                        this.cancelRecognition(this.privRequestSession ? this.privRequestSession.sessionId : "", this.privRequestSession ? this.privRequestSession.requestId : "", c.CancellationReason.Error, c.CancellationErrorCode.RuntimeError, t),
                        [2, null];
                    case 4:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.configConnection = function() {
            var e = this;
            return this.isDisposed() ? Promise.resolve(void 0) : this.privConnectionConfigPromise ? this.privConnectionConfigPromise.then((function(t) {
                return t.state() === a.ConnectionState.Disconnected ? (e.privConnectionId = null,
                e.privConnectionConfigPromise = null,
                e.configConnection()) : e.privConnectionConfigPromise
            }
            ), (function(t) {
                return e.privConnectionId = null,
                e.privConnectionConfigPromise = null,
                e.configConnection()
            }
            )) : this.terminateMessageLoop ? Promise.resolve(void 0) : (this.privConnectionConfigPromise = this.connectImpl().then((function(e) {
                return e
            }
            )),
            this.privConnectionConfigPromise)
        }
        ,
        t.prototype.getTranslations = function(e) {
            var t;
            if (void 0 !== e) {
                t = new c.Translations;
                for (var r = 0, n = e; r < n.length; r++) {
                    var i = n[r];
                    t.set(i.lang, i.translation)
                }
            }
            return t
        }
        ,
        t
    }(u.ServiceRecognizerBase);
    t.ConversationServiceAdapter = d
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
      , i = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConversationRequestSession = void 0;
    var o = r(4)
      , s = function() {
        function e(e) {
            var t = this;
            this.privIsDisposed = !1,
            this.privDetachables = new Array,
            this.onPreConnectionStart = function(e, r) {
                t.privSessionId = r
            }
            ,
            this.onAuthCompleted = function(e, r) {
                e && t.onComplete()
            }
            ,
            this.onConnectionEstablishCompleted = function(e, r) {
                200 !== e && 403 === e && t.onComplete()
            }
            ,
            this.onServiceTurnEndResponse = function(e) {
                e ? t.privRequestId = o.createNoDashGuid() : t.onComplete()
            }
            ,
            this.onComplete = function() {}
            ,
            this.privSessionId = e,
            this.privRequestId = o.createNoDashGuid(),
            this.privRequestCompletionDeferral = new o.Deferred
        }
        return Object.defineProperty(e.prototype, "sessionId", {
            get: function() {
                return this.privSessionId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "requestId", {
            get: function() {
                return this.privRequestId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "completionPromise", {
            get: function() {
                return this.privRequestCompletionDeferral.promise
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.dispose = function(e) {
            return n(this, void 0, void 0, (function() {
                var e, t;
                return i(this, (function(r) {
                    switch (r.label) {
                    case 0:
                        if (this.privIsDisposed)
                            return [3, 4];
                        this.privIsDisposed = !0,
                        e = 0,
                        t = this.privDetachables,
                        r.label = 1;
                    case 1:
                        return e < t.length ? [4, t[e].detach()] : [3, 4];
                    case 2:
                        r.sent(),
                        r.label = 3;
                    case 3:
                        return e++,
                        [3, 1];
                    case 4:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e
    }();
    t.ConversationRequestSession = s
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConversationReceivedTranslationEventArgs = t.ParticipantsListEventArgs = t.ParticipantAttributeEventArgs = t.ParticipantEventArgs = t.LockRoomEventArgs = t.MuteAllEventArgs = void 0;
    var o = r(61)
      , s = function(e) {
        function t(t, r) {
            var n = e.call(this, r) || this;
            return n.privIsMuted = t,
            n
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "isMuted", {
            get: function() {
                return this.privIsMuted
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(o.SessionEventArgs);
    t.MuteAllEventArgs = s;
    var a = function(e) {
        function t(t, r) {
            var n = e.call(this, r) || this;
            return n.privIsLocked = t,
            n
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "isMuted", {
            get: function() {
                return this.privIsLocked
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(o.SessionEventArgs);
    t.LockRoomEventArgs = a;
    var c = function(e) {
        function t(t, r) {
            var n = e.call(this, r) || this;
            return n.privParticipant = t,
            n
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "participant", {
            get: function() {
                return this.privParticipant
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(o.SessionEventArgs);
    t.ParticipantEventArgs = c;
    var u = function(e) {
        function t(t, r, n, i) {
            var o = e.call(this, i) || this;
            return o.privKey = r,
            o.privValue = n,
            o.privParticipantId = t,
            o
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "value", {
            get: function() {
                return this.privValue
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "key", {
            get: function() {
                return this.privKey
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "id", {
            get: function() {
                return this.privParticipantId
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(o.SessionEventArgs);
    t.ParticipantAttributeEventArgs = u;
    var p = function(e) {
        function t(t, r, n, i, o, s, a, c, u) {
            var p = e.call(this, u) || this;
            return p.privRoomId = t,
            p.privSessionToken = r,
            p.privTranslateTo = n,
            p.privProfanityFilter = i,
            p.privRoomProfanityFilter = o,
            p.privIsRoomLocked = s,
            p.privIsRoomLocked = a,
            p.privParticipants = c,
            p
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "sessionToken", {
            get: function() {
                return this.privSessionToken
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "conversationId", {
            get: function() {
                return this.privRoomId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "translateTo", {
            get: function() {
                return this.privTranslateTo
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "profanityFilter", {
            get: function() {
                return this.privProfanityFilter
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "roomProfanityFilter", {
            get: function() {
                return this.privRoomProfanityFilter
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "isRoomLocked", {
            get: function() {
                return this.privIsRoomLocked
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "isMuteAll", {
            get: function() {
                return this.privIsMuteAll
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "participants", {
            get: function() {
                return this.privParticipants
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(o.SessionEventArgs);
    t.ParticipantsListEventArgs = p;
    var l = function() {
        function e(e, t, r) {
            this.privPayload = t,
            this.privCommand = e,
            this.privSessionId = r
        }
        return Object.defineProperty(e.prototype, "payload", {
            get: function() {
                return this.privPayload
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "command", {
            get: function() {
                return this.privCommand
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "sessionId", {
            get: function() {
                return this.privSessionId
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.ConversationReceivedTranslationEventArgs = l
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ConversationTranslatorCommandTypes = t.ConversationTranslatorMessageTypes = t.InternalParticipants = void 0;
    var n = function() {
        function e(e, t) {
            void 0 === e && (e = []),
            this.participants = e,
            this.meId = t
        }
        return e.prototype.addOrUpdateParticipant = function(e) {
            if (void 0 !== e) {
                var t = this.getParticipantIndex(e.id);
                return t > -1 ? this.participants.splice(t, 1, e) : this.participants.push(e),
                this.getParticipant(e.id)
            }
        }
        ,
        e.prototype.getParticipantIndex = function(e) {
            return this.participants.findIndex((function(t) {
                return t.id === e
            }
            ))
        }
        ,
        e.prototype.getParticipant = function(e) {
            return this.participants.find((function(t) {
                return t.id === e
            }
            ))
        }
        ,
        e.prototype.deleteParticipant = function(e) {
            this.participants = this.participants.filter((function(t) {
                return t.id !== e
            }
            ))
        }
        ,
        Object.defineProperty(e.prototype, "host", {
            get: function() {
                return this.participants.find((function(e) {
                    return !0 === e.isHost
                }
                ))
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "me", {
            get: function() {
                return this.getParticipant(this.meId)
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.InternalParticipants = n,
    t.ConversationTranslatorMessageTypes = {
        command: "command",
        final: "final",
        info: "info",
        instantMessage: "instant_message",
        keepAlive: "keep_alive",
        partial: "partial",
        participantCommand: "participant_command",
        translatedMessage: "translated_message"
    },
    t.ConversationTranslatorCommandTypes = {
        changeNickname: "ChangeNickname",
        disconnectSession: "DisconnectSession",
        ejectParticipant: "EjectParticipant",
        instant_message: "instant_message",
        joinSession: "JoinSession",
        leaveSession: "LeaveSession",
        participantList: "ParticipantList",
        roomExpirationWarning: "RoomExpirationWarning",
        setLockState: "SetLockState",
        setMute: "SetMute",
        setMuteAll: "SetMuteAll",
        setProfanityFiltering: "SetProfanityFiltering",
        setTranslateToLanguages: "SetTranslateToLanguages",
        setUseTTS: "SetUseTTS"
    }
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    });
    var n = r(217);
    Object.defineProperty(t, "CommandResponsePayload", {
        enumerable: !0,
        get: function() {
            return n.CommandResponsePayload
        }
    });
    var i = r(218);
    Object.defineProperty(t, "ParticipantsListPayloadResponse", {
        enumerable: !0,
        get: function() {
            return i.ParticipantsListPayloadResponse
        }
    }),
    Object.defineProperty(t, "ParticipantPayloadResponse", {
        enumerable: !0,
        get: function() {
            return i.ParticipantPayloadResponse
        }
    });
    var o = r(219);
    Object.defineProperty(t, "SpeechResponsePayload", {
        enumerable: !0,
        get: function() {
            return o.SpeechResponsePayload
        }
    }),
    Object.defineProperty(t, "TextResponsePayload", {
        enumerable: !0,
        get: function() {
            return o.TextResponsePayload
        }
    })
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.CommandResponsePayload = void 0;
    var n = function() {
        function e(e) {
            this.privCommandResponse = JSON.parse(e)
        }
        return e.fromJSON = function(t) {
            return new e(t)
        }
        ,
        Object.defineProperty(e.prototype, "type", {
            get: function() {
                return this.privCommandResponse.type
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "command", {
            get: function() {
                return this.privCommandResponse.command
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "id", {
            get: function() {
                return this.privCommandResponse.id
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "nickname", {
            get: function() {
                return this.privCommandResponse.nickname
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "participantId", {
            get: function() {
                return this.privCommandResponse.participantId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "roomid", {
            get: function() {
                return this.privCommandResponse.roomid
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "value", {
            get: function() {
                return this.privCommandResponse.value
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "token", {
            get: function() {
                return this.privCommandResponse.token
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.CommandResponsePayload = n
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ParticipantPayloadResponse = t.ParticipantsListPayloadResponse = void 0;
    var n = function() {
        function e(e) {
            this.privParticipantsPayloadResponse = JSON.parse(e)
        }
        return e.fromJSON = function(t) {
            return new e(t)
        }
        ,
        Object.defineProperty(e.prototype, "roomid", {
            get: function() {
                return this.privParticipantsPayloadResponse.roomid
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "id", {
            get: function() {
                return this.privParticipantsPayloadResponse.id
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "command", {
            get: function() {
                return this.privParticipantsPayloadResponse.command
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "participants", {
            get: function() {
                return this.privParticipantsPayloadResponse.participants
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "token", {
            get: function() {
                return this.privParticipantsPayloadResponse.token
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "translateTo", {
            get: function() {
                return this.privParticipantsPayloadResponse.translateTo
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "profanityFilter", {
            get: function() {
                return this.privParticipantsPayloadResponse.profanityFilter
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "roomProfanityFilter", {
            get: function() {
                return this.privParticipantsPayloadResponse.roomProfanityFilter
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "roomLocked", {
            get: function() {
                return this.privParticipantsPayloadResponse.roomLocked
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "muteAll", {
            get: function() {
                return this.privParticipantsPayloadResponse.muteAll
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "type", {
            get: function() {
                return this.privParticipantsPayloadResponse.type
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.ParticipantsListPayloadResponse = n;
    var i = function() {
        function e(e) {
            this.privParticipantPayloadResponse = JSON.parse(e)
        }
        return e.fromJSON = function(t) {
            return new e(t)
        }
        ,
        Object.defineProperty(e.prototype, "nickname", {
            get: function() {
                return this.privParticipantPayloadResponse.nickname
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "locale", {
            get: function() {
                return this.privParticipantPayloadResponse.locale
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "usetts", {
            get: function() {
                return this.privParticipantPayloadResponse.usetts
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "ismuted", {
            get: function() {
                return this.privParticipantPayloadResponse.ismuted
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "ishost", {
            get: function() {
                return this.privParticipantPayloadResponse.ishost
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "participantId", {
            get: function() {
                return this.privParticipantPayloadResponse.participantId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "avatar", {
            get: function() {
                return this.privParticipantPayloadResponse.avatar
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.ParticipantPayloadResponse = i
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.TextResponsePayload = t.SpeechResponsePayload = void 0;
    var n = function() {
        function e(e) {
            this.privSpeechResponse = JSON.parse(e)
        }
        return e.fromJSON = function(t) {
            return new e(t)
        }
        ,
        Object.defineProperty(e.prototype, "recognition", {
            get: function() {
                return this.privSpeechResponse.recognition
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "translations", {
            get: function() {
                return this.privSpeechResponse.translations
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "id", {
            get: function() {
                return this.privSpeechResponse.id
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "language", {
            get: function() {
                return this.privSpeechResponse.language
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "nickname", {
            get: function() {
                return this.privSpeechResponse.nickname
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "participantId", {
            get: function() {
                return this.privSpeechResponse.participantId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "roomid", {
            get: function() {
                return this.privSpeechResponse.roomid
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "timestamp", {
            get: function() {
                return this.privSpeechResponse.timestamp
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "type", {
            get: function() {
                return this.privSpeechResponse.type
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "isFinal", {
            get: function() {
                return "final" === this.privSpeechResponse.type
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.SpeechResponsePayload = n;
    var i = function() {
        function e(e) {
            this.privTextResponse = JSON.parse(e)
        }
        return e.fromJSON = function(t) {
            return new e(t)
        }
        ,
        Object.defineProperty(e.prototype, "originalText", {
            get: function() {
                return this.privTextResponse.originalText
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "translations", {
            get: function() {
                return this.privTextResponse.translations
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "id", {
            get: function() {
                return this.privTextResponse.id
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "language", {
            get: function() {
                return this.privTextResponse.language
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "nickname", {
            get: function() {
                return this.privTextResponse.nickname
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "participantId", {
            get: function() {
                return this.privTextResponse.participantId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "roomid", {
            get: function() {
                return this.privTextResponse.roomid
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "timestamp", {
            get: function() {
                return this.privTextResponse.timestamp
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "type", {
            get: function() {
                return this.privTextResponse.type
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.TextResponsePayload = i
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    ), o = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
    , s = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.TranscriberRecognizer = void 0;
    var a = r(4)
      , c = r(63)
      , u = r(61)
      , p = r(53)
      , l = function(e) {
        function t(t, r) {
            var n = this
              , i = t;
            return c.Contracts.throwIfNull(i, "speechTranslationConfig"),
            c.Contracts.throwIfNullOrWhitespace(i.speechRecognitionLanguage, u.PropertyId[u.PropertyId.SpeechServiceConnection_RecoLanguage]),
            (n = e.call(this, r, i.properties, new p.TranscriberConnectionFactory) || this).privDisposedRecognizer = !1,
            n
        }
        return i(t, e),
        t.prototype.getConversationInfo = function() {
            return c.Contracts.throwIfNullOrUndefined(this.privConversation, "Conversation"),
            this.privConversation.conversationInfo
        }
        ,
        Object.defineProperty(t.prototype, "authorizationToken", {
            get: function() {
                return this.properties.getProperty(u.PropertyId.SpeechServiceAuthorization_Token)
            },
            set: function(e) {
                c.Contracts.throwIfNullOrWhitespace(e, "token"),
                this.properties.setProperty(u.PropertyId.SpeechServiceAuthorization_Token, e)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "conversation", {
            set: function(e) {
                c.Contracts.throwIfNullOrUndefined(e, "Conversation"),
                this.privConversation = e
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "speechRecognitionLanguage", {
            get: function() {
                return c.Contracts.throwIfDisposed(this.privDisposedRecognizer),
                this.properties.getProperty(u.PropertyId.SpeechServiceConnection_RecoLanguage)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "properties", {
            get: function() {
                return this.privProperties
            },
            enumerable: !1,
            configurable: !0
        }),
        t.prototype.startContinuousRecognitionAsync = function(e, t) {
            a.marshalPromiseToCallbacks(this.startContinuousRecognitionAsyncImpl(p.RecognitionMode.Conversation), e, t)
        }
        ,
        t.prototype.stopContinuousRecognitionAsync = function(e, t) {
            a.marshalPromiseToCallbacks(this.stopContinuousRecognitionAsyncImpl(), e, t)
        }
        ,
        t.prototype.close = function() {
            return o(this, void 0, void 0, (function() {
                return s(this, (function(e) {
                    switch (e.label) {
                    case 0:
                        return this.privDisposedRecognizer ? [3, 2] : [4, this.dispose(!0)];
                    case 1:
                        e.sent(),
                        e.label = 2;
                    case 2:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.pushConversationEvent = function(e, t) {
            return o(this, void 0, void 0, (function() {
                var r;
                return s(this, (function(n) {
                    switch (n.label) {
                    case 0:
                        return r = this.privReco,
                        c.Contracts.throwIfNullOrUndefined(r, "serviceRecognizer"),
                        [4, r.sendSpeechEventAsync(e, t)];
                    case 1:
                        return n.sent(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.connectCallbacks = function(e) {
            this.canceled = function(t, r) {
                e.canceled && e.canceled(e, r)
            }
            ,
            this.conversationCanceled = function(t, r) {
                e.conversationCanceled && e.conversationCanceled(e, r)
            }
            ,
            this.recognizing = function(t, r) {
                e.transcribing && e.transcribing(e, r)
            }
            ,
            this.recognized = function(t, r) {
                e.transcribed && e.transcribed(e, r)
            }
            ,
            this.conversationStarted = function(t, r) {
                e.conversationStarted && e.conversationStarted(e, r)
            }
            ,
            this.conversationStopped = function(t, r) {
                e.conversationStopped && e.conversationStopped(e, r)
            }
            ,
            this.sessionStarted = function(t, r) {
                e.sessionStarted && e.sessionStarted(e, r)
            }
            ,
            this.sessionStopped = function(t, r) {
                e.sessionStopped && e.sessionStopped(e, r)
            }
        }
        ,
        t.prototype.disconnectCallbacks = function() {
            this.canceled = void 0,
            this.recognizing = void 0,
            this.recognized = void 0,
            this.sessionStarted = void 0,
            this.sessionStopped = void 0,
            this.conversationCanceled = void 0,
            this.conversationStarted = void 0,
            this.conversationStopped = void 0
        }
        ,
        t.prototype.dispose = function(t) {
            return o(this, void 0, void 0, (function() {
                return s(this, (function(r) {
                    switch (r.label) {
                    case 0:
                        return this.privDisposedRecognizer ? [2] : t ? (this.privDisposedRecognizer = !0,
                        [4, this.implRecognizerStop()]) : [3, 2];
                    case 1:
                        r.sent(),
                        r.label = 2;
                    case 2:
                        return [4, e.prototype.dispose.call(this, t)];
                    case 3:
                        return r.sent(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        t.prototype.createRecognizerConfig = function(e) {
            return new p.RecognizerConfig(e,this.properties)
        }
        ,
        t.prototype.createServiceRecognizer = function(e, t, r, n) {
            var i = r;
            return new p.TranscriptionServiceRecognizer(e,t,i,n,this)
        }
        ,
        t
    }(u.Recognizer);
    t.TranscriberRecognizer = l
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SynthesisAudioMetadata = t.MetadataType = void 0,
    function(e) {
        e.WordBoundary = "WordBoundary",
        e.Bookmark = "Bookmark",
        e.Viseme = "Viseme"
    }(t.MetadataType || (t.MetadataType = {}));
    var n = function() {
        function e(e) {
            this.privSynthesisAudioMetadata = JSON.parse(e)
        }
        return e.fromJSON = function(t) {
            return new e(t)
        }
        ,
        Object.defineProperty(e.prototype, "Metadata", {
            get: function() {
                return this.privSynthesisAudioMetadata.Metadata
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.SynthesisAudioMetadata = n
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
      , i = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SynthesisTurn = void 0;
    var o = r(4)
      , s = r(73)
      , a = r(223)
      , c = r(224)
      , u = function() {
        function e() {
            var e = this;
            this.privIsDisposed = !1,
            this.privIsSynthesizing = !1,
            this.privIsSynthesisEnded = !1,
            this.privBytesReceived = 0,
            this.privInTurn = !1,
            this.privTextOffset = 0,
            this.privNextSearchTextIndex = 0,
            this.onPreConnectionStart = function(t, r) {
                e.privAuthFetchEventId = t,
                e.onEvent(new c.ConnectingToSynthesisServiceEvent(e.privRequestId,e.privAuthFetchEventId))
            }
            ,
            this.onAuthCompleted = function(t, r) {
                t && e.onComplete()
            }
            ,
            this.onConnectionEstablishCompleted = function(t, r) {
                if (200 === t)
                    return e.onEvent(new c.SynthesisStartedEvent(e.requestId,e.privAuthFetchEventId)),
                    void (e.privBytesReceived = 0);
                403 === t && e.onComplete()
            }
            ,
            this.onServiceResponseMessage = function(t) {
                var r = JSON.parse(t);
                e.streamId = r.audio.streamId
            }
            ,
            this.onServiceTurnEndResponse = function() {
                e.privInTurn = !1,
                e.privTurnDeferral.resolve(),
                e.onComplete()
            }
            ,
            this.onServiceTurnStartResponse = function() {
                e.privTurnDeferral && e.privInTurn && (e.privTurnDeferral.reject("Another turn started before current completed."),
                e.privTurnDeferral.promise.then().catch((function() {}
                ))),
                e.privInTurn = !0,
                e.privTurnDeferral = new o.Deferred
            }
            ,
            this.dispose = function(t) {
                e.privIsDisposed || (e.privIsDisposed = !0)
            }
            ,
            this.onEvent = function(e) {
                o.Events.instance.onEvent(e)
            }
            ,
            this.onComplete = function() {
                e.privIsSynthesizing && (e.privIsSynthesizing = !1,
                e.privIsSynthesisEnded = !0,
                e.privAudioOutputStream.close(),
                e.privInTurn = !1,
                void 0 !== e.privTurnAudioDestination && (e.privTurnAudioDestination.close(),
                e.privTurnAudioDestination = void 0))
            }
            ,
            this.privRequestId = o.createNoDashGuid(),
            this.privTurnDeferral = new o.Deferred,
            this.privTurnDeferral.resolve()
        }
        return Object.defineProperty(e.prototype, "requestId", {
            get: function() {
                return this.privRequestId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "streamId", {
            get: function() {
                return this.privStreamId
            },
            set: function(e) {
                this.privStreamId = e
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "audioOutputFormat", {
            get: function() {
                return this.privAudioOutputFormat
            },
            set: function(e) {
                this.privAudioOutputFormat = e
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "turnCompletionPromise", {
            get: function() {
                return this.privTurnDeferral.promise
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "isSynthesisEnded", {
            get: function() {
                return this.privIsSynthesisEnded
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "isSynthesizing", {
            get: function() {
                return this.privIsSynthesizing
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "currentTextOffset", {
            get: function() {
                return this.privTextOffset
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "bytesReceived", {
            get: function() {
                return this.privBytesReceived
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.getAllReceivedAudio = function() {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(e) {
                    switch (e.label) {
                    case 0:
                        return this.privReceivedAudio ? [2, Promise.resolve(this.privReceivedAudio)] : this.privIsSynthesisEnded ? [4, this.readAllAudioFromStream()] : [2, null];
                    case 1:
                        return e.sent(),
                        [2, Promise.resolve(this.privReceivedAudio)]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.getAllReceivedAudioWithHeader = function() {
            return n(this, void 0, void 0, (function() {
                var e;
                return i(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return this.privReceivedAudioWithHeader ? [2, this.privReceivedAudioWithHeader] : this.privIsSynthesisEnded ? this.audioOutputFormat.hasHeader ? [4, this.getAllReceivedAudio()] : [3, 2] : [2, null];
                    case 1:
                        return e = t.sent(),
                        this.privReceivedAudioWithHeader = a.SynthesisAdapterBase.addHeader(e, this.audioOutputFormat),
                        [2, this.privReceivedAudioWithHeader];
                    case 2:
                        return [2, this.getAllReceivedAudio()]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.startNewSynthesis = function(e, t, r, n) {
            this.privIsSynthesisEnded = !1,
            this.privIsSynthesizing = !0,
            this.privRequestId = e,
            this.privRawText = t,
            this.privIsSSML = r,
            this.privAudioOutputStream = new s.PullAudioOutputStreamImpl,
            this.privAudioOutputStream.format = this.privAudioOutputFormat,
            this.privReceivedAudio = null,
            this.privReceivedAudioWithHeader = null,
            this.privBytesReceived = 0,
            this.privTextOffset = 0,
            this.privNextSearchTextIndex = 0,
            this.privPartialVisemeAnimation = "",
            void 0 !== n && (this.privTurnAudioDestination = n,
            this.privTurnAudioDestination.format = this.privAudioOutputFormat),
            this.onEvent(new c.SynthesisTriggeredEvent(this.requestId,void 0,void 0 === n ? void 0 : n.id()))
        }
        ,
        e.prototype.onAudioChunkReceived = function(e) {
            this.isSynthesizing && (this.privAudioOutputStream.write(e),
            this.privBytesReceived += e.byteLength,
            void 0 !== this.privTurnAudioDestination && this.privTurnAudioDestination.write(e))
        }
        ,
        e.prototype.onWordBoundaryEvent = function(e) {
            this.updateTextOffset(e)
        }
        ,
        e.prototype.onVisemeMetadataReceived = function(e) {
            void 0 !== e.Data.AnimationChunk && (this.privPartialVisemeAnimation += e.Data.AnimationChunk)
        }
        ,
        e.prototype.onStopSynthesizing = function() {
            this.onComplete()
        }
        ,
        e.prototype.getAndClearVisemeAnimation = function() {
            var e = this.privPartialVisemeAnimation;
            return this.privPartialVisemeAnimation = "",
            e
        }
        ,
        e.prototype.updateTextOffset = function(e) {
            this.privTextOffset >= 0 && (this.privTextOffset = this.privRawText.indexOf(e, this.privNextSearchTextIndex),
            this.privTextOffset >= 0 && (this.privNextSearchTextIndex = this.privTextOffset + e.length),
            this.privIsSSML && this.privRawText.indexOf("<", this.privTextOffset + 1) > this.privRawText.indexOf(">", this.privTextOffset + 1) && this.updateTextOffset(e))
        }
        ,
        e.prototype.readAllAudioFromStream = function() {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(e) {
                    switch (e.label) {
                    case 0:
                        if (!this.privIsSynthesisEnded)
                            return [3, 4];
                        this.privReceivedAudio = new ArrayBuffer(this.bytesReceived),
                        e.label = 1;
                    case 1:
                        return e.trys.push([1, 3, , 4]),
                        [4, this.privAudioOutputStream.read(this.privReceivedAudio)];
                    case 2:
                        return e.sent(),
                        [3, 4];
                    case 3:
                        return e.sent(),
                        this.privReceivedAudio = new ArrayBuffer(0),
                        [3, 4];
                    case 4:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e
    }();
    t.SynthesisTurn = u
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
      , i = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SynthesisAdapterBase = void 0;
    var o = r(4)
      , s = r(61)
      , a = r(53)
      , c = r(170)
      , u = function() {
        function e(e, t, r, n, i) {
            var u = this;
            if (this.speakOverride = void 0,
            this.receiveMessageOverride = void 0,
            this.connectImplOverride = void 0,
            this.configConnectionOverride = void 0,
            this.sendSynthesisContext = function(e) {
                var t = u.synthesisContext.toJSON();
                if (t)
                    return e.send(new c.SpeechConnectionMessage(o.MessageType.Text,"synthesis.context",u.privSynthesisTurn.requestId,"application/json",t))
            }
            ,
            this.sendSpeechServiceConfig = function(e, t) {
                if (t)
                    return e.send(new c.SpeechConnectionMessage(o.MessageType.Text,"speech.config",u.privSynthesisTurn.requestId,"application/json",t))
            }
            ,
            this.sendSsmlMessage = function(e, t, r) {
                return e.send(new c.SpeechConnectionMessage(o.MessageType.Text,"ssml",r,"application/ssml+xml",t))
            }
            ,
            !e)
                throw new o.ArgumentNullError("authentication");
            if (!t)
                throw new o.ArgumentNullError("connectionFactory");
            if (!r)
                throw new o.ArgumentNullError("synthesizerConfig");
            this.privAuthentication = e,
            this.privConnectionFactory = t,
            this.privSynthesizerConfig = r,
            this.privIsDisposed = !1,
            this.privSpeechSynthesizer = n,
            this.privSessionAudioDestination = i,
            this.privSynthesisTurn = new a.SynthesisTurn,
            this.privConnectionEvents = new o.EventSource,
            this.privServiceEvents = new o.EventSource,
            this.privSynthesisContext = new a.SynthesisContext(this.privSpeechSynthesizer),
            this.privAgentConfig = new a.AgentConfig,
            this.connectionEvents.attach((function(e) {
                if ("ConnectionClosedEvent" === e.name) {
                    var t = e;
                    1e3 !== t.statusCode && u.cancelSynthesisLocal(s.CancellationReason.Error, 1007 === t.statusCode ? s.CancellationErrorCode.BadRequestParameters : s.CancellationErrorCode.ConnectionFailure, t.reason + " websocket error code: " + t.statusCode)
                }
            }
            ))
        }
        return Object.defineProperty(e.prototype, "synthesisContext", {
            get: function() {
                return this.privSynthesisContext
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "agentConfig", {
            get: function() {
                return this.privAgentConfig
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "connectionEvents", {
            get: function() {
                return this.privConnectionEvents
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "serviceEvents", {
            get: function() {
                return this.privServiceEvents
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "activityTemplate", {
            get: function() {
                return this.privActivityTemplate
            },
            set: function(e) {
                this.privActivityTemplate = e
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "audioOutputFormat", {
            set: function(e) {
                this.privAudioOutputFormat = e,
                this.privSynthesisTurn.audioOutputFormat = e,
                void 0 !== this.privSessionAudioDestination && (this.privSessionAudioDestination.format = e),
                void 0 !== this.synthesisContext && (this.synthesisContext.audioOutputFormat = e)
            },
            enumerable: !1,
            configurable: !0
        }),
        e.addHeader = function(e, t) {
            if (!t.hasHeader)
                return e;
            t.updateHeader(e.byteLength);
            var r = new Uint8Array(e.byteLength + t.header.byteLength);
            return r.set(new Uint8Array(t.header), 0),
            r.set(new Uint8Array(e), t.header.byteLength),
            r.buffer
        }
        ,
        e.prototype.isDisposed = function() {
            return this.privIsDisposed
        }
        ,
        e.prototype.dispose = function(e) {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return this.privIsDisposed = !0,
                        void 0 !== this.privSessionAudioDestination && this.privSessionAudioDestination.close(),
                        this.privConnectionConfigurationPromise ? [4, this.privConnectionConfigurationPromise] : [3, 3];
                    case 1:
                        return [4, t.sent().dispose(e)];
                    case 2:
                        t.sent(),
                        t.label = 3;
                    case 3:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.connect = function() {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(e) {
                    switch (e.label) {
                    case 0:
                        return [4, this.connectImpl()];
                    case 1:
                        return e.sent(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.sendNetworkMessage = function(e, t) {
            return n(this, void 0, void 0, (function() {
                var r, n;
                return i(this, (function(i) {
                    switch (i.label) {
                    case 0:
                        return r = "string" == typeof t ? o.MessageType.Text : o.MessageType.Binary,
                        n = "string" == typeof t ? "application/json" : "",
                        [4, this.fetchConnection()];
                    case 1:
                        return [2, i.sent().send(new c.SpeechConnectionMessage(r,e,this.privSynthesisTurn.requestId,n,t))]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.Speak = function(e, t, r, o, a, c) {
            return n(this, void 0, void 0, (function() {
                var n, u, p, l;
                return i(this, (function(i) {
                    switch (i.label) {
                    case 0:
                        if (n = t ? e : this.privSpeechSynthesizer.buildSsml(e),
                        void 0 !== this.speakOverride)
                            return [2, this.speakOverride(n, r, o, a)];
                        this.privSuccessCallback = o,
                        this.privErrorCallback = a,
                        this.privSynthesisTurn.startNewSynthesis(r, e, t, c),
                        i.label = 1;
                    case 1:
                        return i.trys.push([1, 6, , 7]),
                        [4, this.connectImpl()];
                    case 2:
                        return i.sent(),
                        [4, this.fetchConnection()];
                    case 3:
                        return u = i.sent(),
                        [4, this.sendSynthesisContext(u)];
                    case 4:
                        return i.sent(),
                        [4, this.sendSsmlMessage(u, n, r)];
                    case 5:
                        return i.sent(),
                        p = new s.SpeechSynthesisEventArgs(new s.SpeechSynthesisResult(r,s.ResultReason.SynthesizingAudioStarted)),
                        this.privSpeechSynthesizer.synthesisStarted && this.privSpeechSynthesizer.synthesisStarted(this.privSpeechSynthesizer, p),
                        this.receiveMessage(),
                        [3, 7];
                    case 6:
                        return l = i.sent(),
                        this.cancelSynthesisLocal(s.CancellationReason.Error, s.CancellationErrorCode.ConnectionFailure, l),
                        [2, Promise.reject(l)];
                    case 7:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.cancelSynthesis = function(e, t, r, n) {
            var i = new s.PropertyCollection;
            i.setProperty(a.CancellationErrorCodePropertyName, s.CancellationErrorCode[r]);
            var o = new s.SpeechSynthesisResult(e,s.ResultReason.Canceled,void 0,n,i);
            if (this.privSpeechSynthesizer.SynthesisCanceled) {
                var c = new s.SpeechSynthesisEventArgs(o);
                try {
                    this.privSpeechSynthesizer.SynthesisCanceled(this.privSpeechSynthesizer, c)
                } catch (e) {}
            }
            if (this.privSuccessCallback)
                try {
                    this.privSuccessCallback(o)
                } catch (e) {}
        }
        ,
        e.prototype.cancelSynthesisLocal = function(e, t, r) {
            this.privSynthesisTurn.isSynthesizing && (this.privSynthesisTurn.onStopSynthesizing(),
            this.cancelSynthesis(this.privSynthesisTurn.requestId, e, t, r))
        }
        ,
        e.prototype.processTypeSpecificMessages = function(e, t, r) {
            return !0
        }
        ,
        e.prototype.receiveMessage = function() {
            return n(this, void 0, void 0, (function() {
                var t, r, n, u, p, l, f, h, v, d, y, g, m, b;
                return i(this, (function(i) {
                    switch (i.label) {
                    case 0:
                        return i.trys.push([0, 14, , 15]),
                        [4, this.fetchConnection()];
                    case 1:
                        return [4, i.sent().read()];
                    case 2:
                        if (t = i.sent(),
                        void 0 !== this.receiveMessageOverride)
                            return [2, this.receiveMessageOverride()];
                        if (this.privIsDisposed)
                            return [2];
                        if (!t)
                            return this.privSynthesisTurn.isSynthesizing ? [2, this.receiveMessage()] : [2];
                        if (this.privServiceHasSentMessage = !0,
                        (r = c.SpeechConnectionMessage.fromConnectionMessage(t)).requestId.toLowerCase() !== this.privSynthesisTurn.requestId.toLowerCase())
                            return [3, 13];
                        switch (r.path.toLowerCase()) {
                        case "turn.start":
                            return [3, 3];
                        case "response":
                            return [3, 4];
                        case "audio":
                            return [3, 5];
                        case "audio.metadata":
                            return [3, 6];
                        case "turn.end":
                            return [3, 7]
                        }
                        return [3, 12];
                    case 3:
                        return this.privSynthesisTurn.onServiceTurnStartResponse(),
                        [3, 13];
                    case 4:
                        return this.privSynthesisTurn.onServiceResponseMessage(r.textBody),
                        [3, 13];
                    case 5:
                        if (this.privSynthesisTurn.streamId.toLowerCase() === r.streamId.toLowerCase() && r.binaryBody) {
                            if (this.privSynthesisTurn.onAudioChunkReceived(r.binaryBody),
                            this.privSpeechSynthesizer.synthesizing)
                                try {
                                    n = e.addHeader(r.binaryBody, this.privSynthesisTurn.audioOutputFormat),
                                    u = new s.SpeechSynthesisEventArgs(new s.SpeechSynthesisResult(this.privSynthesisTurn.requestId,s.ResultReason.SynthesizingAudio,n)),
                                    this.privSpeechSynthesizer.synthesizing(this.privSpeechSynthesizer, u)
                                } catch (e) {}
                            void 0 !== this.privSessionAudioDestination && this.privSessionAudioDestination.write(r.binaryBody)
                        }
                        return [3, 13];
                    case 6:
                        for (p = a.SynthesisAudioMetadata.fromJSON(r.textBody).Metadata,
                        l = 0,
                        f = p; l < f.length; l++)
                            switch ((h = f[l]).Type) {
                            case a.MetadataType.WordBoundary:
                                if (this.privSynthesisTurn.onWordBoundaryEvent(h.Data.text.Text),
                                v = new s.SpeechSynthesisWordBoundaryEventArgs(h.Data.Offset,h.Data.text.Text,h.Data.text.Length,this.privSynthesisTurn.currentTextOffset),
                                this.privSpeechSynthesizer.wordBoundary)
                                    try {
                                        this.privSpeechSynthesizer.wordBoundary(this.privSpeechSynthesizer, v)
                                    } catch (e) {}
                                break;
                            case a.MetadataType.Bookmark:
                                if (d = new s.SpeechSynthesisBookmarkEventArgs(h.Data.Offset,h.Data.Bookmark),
                                this.privSpeechSynthesizer.bookmarkReached)
                                    try {
                                        this.privSpeechSynthesizer.bookmarkReached(this.privSpeechSynthesizer, d)
                                    } catch (e) {}
                                break;
                            case a.MetadataType.Viseme:
                                if (this.privSynthesisTurn.onVisemeMetadataReceived(h),
                                h.Data.IsLastAnimation && (y = new s.SpeechSynthesisVisemeEventArgs(h.Data.Offset,h.Data.VisemeId,this.privSynthesisTurn.getAndClearVisemeAnimation()),
                                this.privSpeechSynthesizer.visemeReceived))
                                    try {
                                        this.privSpeechSynthesizer.visemeReceived(this.privSpeechSynthesizer, y)
                                    } catch (e) {}
                            }
                        return [3, 13];
                    case 7:
                        this.privSynthesisTurn.onServiceTurnEndResponse(),
                        g = void 0,
                        i.label = 8;
                    case 8:
                        return i.trys.push([8, 10, , 11]),
                        [4, this.privSynthesisTurn.getAllReceivedAudioWithHeader()];
                    case 9:
                        return m = i.sent(),
                        g = new s.SpeechSynthesisResult(this.privSynthesisTurn.requestId,s.ResultReason.SynthesizingAudioCompleted,m),
                        this.privSuccessCallback && this.privSuccessCallback(g),
                        [3, 11];
                    case 10:
                        return b = i.sent(),
                        this.privErrorCallback && this.privErrorCallback(b),
                        [3, 11];
                    case 11:
                        if (this.privSpeechSynthesizer.synthesisCompleted)
                            try {
                                //debugger;
                                //console.log(URL.createObjectURL(new Blob([g.privAudioData], { type: "audio/mp3" })));
                                this.privSpeechSynthesizer.synthesisCompleted(this.privSpeechSynthesizer, new s.SpeechSynthesisEventArgs(g))
                            } catch (e) {}
                        return [3, 13];
                    case 12:
                        this.processTypeSpecificMessages(r) || this.privServiceEvents && this.serviceEvents.onEvent(new o.ServiceEvent(r.path.toLowerCase(),r.textBody)),
                        i.label = 13;
                    case 13:
                        return [2, this.receiveMessage()];
                    case 14:
                        return i.sent(),
                        [3, 15];
                    case 15:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.connectImpl = function(e) {
            var t = this;
            if (void 0 === e && (e = !1),
            this.privConnectionPromise)
                return this.privConnectionPromise.then((function(e) {
                    return e.state() === o.ConnectionState.Disconnected ? (t.privConnectionId = null,
                    t.privConnectionPromise = null,
                    t.privServiceHasSentMessage = !1,
                    t.connectImpl()) : t.privConnectionPromise
                }
                ), (function(e) {
                    return t.privConnectionId = null,
                    t.privConnectionPromise = null,
                    t.privServiceHasSentMessage = !1,
                    t.connectImpl()
                }
                ));
            this.privAuthFetchEventId = o.createNoDashGuid(),
            this.privConnectionId = o.createNoDashGuid(),
            this.privSynthesisTurn.onPreConnectionStart(this.privAuthFetchEventId, this.privConnectionId);
            var r = e ? this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId) : this.privAuthentication.fetch(this.privAuthFetchEventId);
            return this.privConnectionPromise = r.then((function(r) {
                return n(t, void 0, void 0, (function() {
                    var t, n, o = this;
                    return i(this, (function(i) {
                        switch (i.label) {
                        case 0:
                            return [4, this.privSynthesisTurn.onAuthCompleted(!1)];
                        case 1:
                            return i.sent(),
                            (t = this.privConnectionFactory.create(this.privSynthesizerConfig, r, this.privConnectionId)).events.attach((function(e) {
                                o.connectionEvents.onEvent(e)
                            }
                            )),
                            [4, t.open()];
                        case 2:
                            return 200 !== (n = i.sent()).statusCode ? [3, 4] : [4, this.privSynthesisTurn.onConnectionEstablishCompleted(n.statusCode)];
                        case 3:
                            return i.sent(),
                            [2, Promise.resolve(t)];
                        case 4:
                            return 403 !== n.statusCode || e ? [3, 5] : [2, this.connectImpl(!0)];
                        case 5:
                            return [4, this.privSynthesisTurn.onConnectionEstablishCompleted(n.statusCode, n.reason)];
                        case 6:
                            return i.sent(),
                            [2, Promise.reject("Unable to contact server. StatusCode: " + n.statusCode + ", " + this.privSynthesizerConfig.parameters.getProperty(s.PropertyId.SpeechServiceConnection_Endpoint) + " Reason: " + n.reason)]
                        }
                    }
                    ))
                }
                ))
            }
            ), (function(e) {
                return n(t, void 0, void 0, (function() {
                    return i(this, (function(t) {
                        switch (t.label) {
                        case 0:
                            return [4, this.privSynthesisTurn.onAuthCompleted(!0, e)];
                        case 1:
                            throw t.sent(),
                            new Error(e)
                        }
                    }
                    ))
                }
                ))
            }
            )),
            this.privConnectionPromise.catch((function() {}
            )),
            this.privConnectionPromise
        }
        ,
        e.prototype.fetchConnection = function() {
            return n(this, void 0, void 0, (function() {
                var e = this;
                return i(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return this.privConnectionConfigurationPromise ? [2, this.privConnectionConfigurationPromise.then((function(t) {
                            return t.state() === o.ConnectionState.Disconnected ? (e.privConnectionId = null,
                            e.privConnectionConfigurationPromise = null,
                            e.privServiceHasSentMessage = !1,
                            e.fetchConnection()) : e.privConnectionConfigurationPromise
                        }
                        ), (function(t) {
                            return e.privConnectionId = null,
                            e.privConnectionConfigurationPromise = null,
                            e.privServiceHasSentMessage = !1,
                            e.fetchConnection()
                        }
                        ))] : (this.privConnectionConfigurationPromise = this.configureConnection(),
                        [4, this.privConnectionConfigurationPromise]);
                    case 1:
                        return [2, t.sent()]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.configureConnection = function() {
            return n(this, void 0, void 0, (function() {
                var e;
                return i(this, (function(t) {
                    switch (t.label) {
                    case 0:
                        return [4, this.connectImpl()];
                    case 1:
                        return e = t.sent(),
                        void 0 !== this.configConnectionOverride ? [2, this.configConnectionOverride(e)] : [4, this.sendSpeechServiceConfig(e, this.privSynthesizerConfig.SpeechServiceConfig.serialize())];
                    case 2:
                        return t.sent(),
                        [2, e]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.telemetryDataEnabled = !0,
        e
    }();
    t.SynthesisAdapterBase = u
}
, function(e, t, r) {
    "use strict";
    var n, i = this && this.__extends || (n = function(e, t) {
        return (n = Object.setPrototypeOf || {
            __proto__: []
        }instanceof Array && function(e, t) {
            e.__proto__ = t
        }
        || function(e, t) {
            for (var r in t)
                t.hasOwnProperty(r) && (e[r] = t[r])
        }
        )(e, t)
    }
    ,
    function(e, t) {
        function r() {
            this.constructor = e
        }
        n(e, t),
        e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype,
        new r)
    }
    );
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SynthesisStartedEvent = t.ConnectingToSynthesisServiceEvent = t.SynthesisTriggeredEvent = t.SpeechSynthesisEvent = void 0;
    var o = r(4)
      , s = function(e) {
        function t(t, r, n) {
            void 0 === n && (n = o.EventType.Info);
            var i = e.call(this, t, n) || this;
            return i.privRequestId = r,
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "requestId", {
            get: function() {
                return this.privRequestId
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(o.PlatformEvent);
    t.SpeechSynthesisEvent = s;
    var a = function(e) {
        function t(t, r, n) {
            var i = e.call(this, "SynthesisTriggeredEvent", t) || this;
            return i.privSessionAudioDestinationId = r,
            i.privTurnAudioDestinationId = n,
            i
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "audioSessionDestinationId", {
            get: function() {
                return this.privSessionAudioDestinationId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(t.prototype, "audioTurnDestinationId", {
            get: function() {
                return this.privTurnAudioDestinationId
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(s);
    t.SynthesisTriggeredEvent = a;
    var c = function(e) {
        function t(t, r) {
            var n = e.call(this, "ConnectingToSynthesisServiceEvent", t) || this;
            return n.privAuthFetchEventId = r,
            n
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "authFetchEventId", {
            get: function() {
                return this.privAuthFetchEventId
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(s);
    t.ConnectingToSynthesisServiceEvent = c;
    var u = function(e) {
        function t(t, r) {
            var n = e.call(this, "SynthesisStartedEvent", t) || this;
            return n.privAuthFetchEventId = r,
            n
        }
        return i(t, e),
        Object.defineProperty(t.prototype, "authFetchEventId", {
            get: function() {
                return this.privAuthFetchEventId
            },
            enumerable: !1,
            configurable: !0
        }),
        t
    }(s);
    t.SynthesisStartedEvent = u
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SynthesizerConfig = t.SynthesisServiceType = void 0;
    var n, i = r(53);
    !function(e) {
        e[e.Standard = 0] = "Standard",
        e[e.Custom = 1] = "Custom"
    }(n = t.SynthesisServiceType || (t.SynthesisServiceType = {}));
    var o = function() {
        function e(e, t) {
            this.privSynthesisServiceType = n.Standard,
            this.privSpeechServiceConfig = e || new i.SpeechServiceConfig(new i.Context(null)),
            this.privParameters = t
        }
        return Object.defineProperty(e.prototype, "parameters", {
            get: function() {
                return this.privParameters
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "synthesisServiceType", {
            get: function() {
                return this.privSynthesisServiceType
            },
            set: function(e) {
                this.privSynthesisServiceType = e
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "SpeechServiceConfig", {
            get: function() {
                return this.privSpeechServiceConfig
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.SynthesizerConfig = o
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SynthesisContext = void 0;
    var n = function() {
        function e(e) {
            this.privContext = {},
            this.privSpeechSynthesizer = e
        }
        return e.prototype.setSection = function(e, t) {
            this.privContext[e] = t
        }
        ,
        Object.defineProperty(e.prototype, "audioOutputFormat", {
            set: function(e) {
                this.privAudioOutputFormat = e
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.toJSON = function() {
            var e = this.buildSynthesisContext();
            return this.setSection("synthesis", e),
            JSON.stringify(this.privContext)
        }
        ,
        e.prototype.buildSynthesisContext = function() {
            return {
                audio: {
                    metadataOptions: {
                        bookmarkEnabled: !!this.privSpeechSynthesizer.bookmarkReached,
                        sentenceBoundaryEnabled: !1,
                        visemeEnabled: !!this.privSpeechSynthesizer.visemeReceived,
                        wordBoundaryEnabled: !!this.privSpeechSynthesizer.wordBoundary
                    },
                    outputFormat: this.privAudioOutputFormat.requestAudioFormatString
                },
                language: {
                    autoDetection: this.privSpeechSynthesizer.autoDetectSourceLanguage
                }
            }
        }
        ,
        e
    }();
    t.SynthesisContext = n
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeakerRecognitionConfig = void 0;
    var n = r(53)
      , i = function() {
        function e(e, t) {
            this.privContext = e || new n.Context(null),
            this.privParameters = t
        }
        return Object.defineProperty(e.prototype, "parameters", {
            get: function() {
                return this.privParameters
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Context", {
            get: function() {
                return this.privContext
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.SpeakerRecognitionConfig = i
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
      , i = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.SpeakerIdMessageAdapter = void 0;
    var o = r(2)
      , s = r(61)
      , a = r(123)
      , c = function() {
        function e(e) {
            var t = e.parameters.getProperty(s.PropertyId.SpeechServiceConnection_Endpoint, void 0);
            if (!t) {
                var r = e.parameters.getProperty(s.PropertyId.SpeechServiceConnection_Region, "westus")
                  , n = a.ConnectionFactoryBase.getHostSuffix(r);
                t = e.parameters.getProperty(s.PropertyId.SpeechServiceConnection_Host, "https://" + r + ".api.cognitive" + n)
            }
            this.privUri = t + "/speaker-recognition/{mode}/{dependency}/profiles";
            var i = o.RestConfigBase.requestOptions;
            i.headers[o.RestConfigBase.configParams.subscriptionKey] = e.parameters.getProperty(s.PropertyId.SpeechServiceConnection_Key, void 0),
            this.privApiVersion = e.parameters.getProperty(s.PropertyId.SpeakerRecognition_Api_Version, "2021-09-05"),
            this.privRestAdapter = new o.RestMessageAdapter(i)
        }
        return e.prototype.createProfile = function(e, t) {
            var r = this.getOperationUri(e);
            return this.privRestAdapter.request(o.RestRequestType.Post, r, this.getQueryParams(), {
                locale: t
            })
        }
        ,
        e.prototype.createEnrollment = function(e, t) {
            var r = this
              , n = this.getOperationUri(e.profileType) + "/" + e.profileId + "/enrollments";
            return t.blob.then((function(e) {
                return r.privRestAdapter.request(o.RestRequestType.File, n, r.getQueryParams({
                    ignoreMinLength: "true"
                }), null, e)
            }
            ))
        }
        ,
        e.prototype.verifySpeaker = function(e, t) {
            return n(this, void 0, void 0, (function() {
                var r, n, s;
                return i(this, (function(i) {
                    switch (i.label) {
                    case 0:
                        r = this.getOperationUri(e.voiceProfile.profileType) + "/" + e.voiceProfile.profileId + ":verify",
                        i.label = 1;
                    case 1:
                        return i.trys.push([1, 3, , 4]),
                        [4, t.blob];
                    case 2:
                        return n = i.sent(),
                        [2, this.privRestAdapter.request(o.RestRequestType.File, r, this.getQueryParams({
                            ignoreMinLength: "true"
                        }), null, n)];
                    case 3:
                        return s = i.sent(),
                        [2, Promise.resolve({
                            data: s
                        })];
                    case 4:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.identifySpeaker = function(e, t) {
            return n(this, void 0, void 0, (function() {
                var r, n, a;
                return i(this, (function(i) {
                    switch (i.label) {
                    case 0:
                        r = this.getOperationUri(s.VoiceProfileType.TextIndependentIdentification) + ":identifySingleSpeaker",
                        i.label = 1;
                    case 1:
                        return i.trys.push([1, 3, , 4]),
                        [4, t.blob];
                    case 2:
                        return n = i.sent(),
                        [2, this.privRestAdapter.request(o.RestRequestType.File, r, this.getQueryParams({
                            profileIds: e.voiceProfileIds,
                            ignoreMinLength: "true"
                        }), null, n)];
                    case 3:
                        return a = i.sent(),
                        [2, Promise.resolve({
                            data: a
                        })];
                    case 4:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.getProfileStatus = function(e) {
            var t = this.getOperationUri(e.profileType) + "/" + e.profileId;
            return this.privRestAdapter.request(o.RestRequestType.Get, t, this.getQueryParams())
        }
        ,
        e.prototype.getProfiles = function(e) {
            var t = this.getOperationUri(e);
            return this.privRestAdapter.request(o.RestRequestType.Get, t, this.getQueryParams())
        }
        ,
        e.prototype.getPhrases = function(e, t) {
            var r = ("" + this.getOperationUri(e)).replace("profiles", "phrases") + "/" + t;
            return this.privRestAdapter.request(o.RestRequestType.Get, r, this.getQueryParams())
        }
        ,
        e.prototype.deleteProfile = function(e) {
            var t = this.getOperationUri(e.profileType) + "/" + e.profileId;
            return this.privRestAdapter.request(o.RestRequestType.Delete, t, this.getQueryParams())
        }
        ,
        e.prototype.resetProfile = function(e) {
            var t = this.getOperationUri(e.profileType) + "/" + e.profileId + ":reset";
            return this.privRestAdapter.request(o.RestRequestType.Post, t, this.getQueryParams())
        }
        ,
        e.prototype.getOperationUri = function(e) {
            var t = e === s.VoiceProfileType.TextIndependentIdentification ? "identification" : "verification"
              , r = e === s.VoiceProfileType.TextDependentVerification ? "text-dependent" : "text-independent";
            return this.privUri.replace("{mode}", t).replace("{dependency}", r)
        }
        ,
        e.prototype.getQueryParams = function(e) {
            return void 0 === e && (e = {}),
            e[o.RestConfigBase.configParams.apiVersion] = this.privApiVersion,
            e
        }
        ,
        e
    }();
    t.SpeakerIdMessageAdapter = c
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
      , i = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.FileAudioSource = void 0;
    var o = r(53)
      , s = r(4)
      , a = r(72)
      , c = function() {
        function e(e, t, r) {
            var o = this;
            this.privStreams = {},
            this.privHeaderEnd = 44,
            this.turnOn = function() {
                if (o.privFilename.lastIndexOf(".wav") !== o.privFilename.length - 4) {
                    var e = o.privFilename + " is not supported. Only WAVE files are allowed at the moment.";
                    return o.onEvent(new s.AudioSourceErrorEvent(e,"")),
                    Promise.reject(e)
                }
                o.onEvent(new s.AudioSourceInitializingEvent(o.privId)),
                o.onEvent(new s.AudioSourceReadyEvent(o.privId))
            }
            ,
            this.id = function() {
                return o.privId
            }
            ,
            this.attach = function(e) {
                return n(o, void 0, void 0, (function() {
                    var t, r = this;
                    return i(this, (function(o) {
                        switch (o.label) {
                        case 0:
                            return this.onEvent(new s.AudioStreamNodeAttachingEvent(this.privId,e)),
                            [4, this.upload(e)];
                        case 1:
                            return t = o.sent(),
                            this.onEvent(new s.AudioStreamNodeAttachedEvent(this.privId,e)),
                            [2, Promise.resolve({
                                detach: function() {
                                    return n(r, void 0, void 0, (function() {
                                        return i(this, (function(r) {
                                            switch (r.label) {
                                            case 0:
                                                return t.readEnded(),
                                                delete this.privStreams[e],
                                                this.onEvent(new s.AudioStreamNodeDetachedEvent(this.privId,e)),
                                                [4, this.turnOff()];
                                            case 1:
                                                return r.sent(),
                                                [2]
                                            }
                                        }
                                        ))
                                    }
                                    ))
                                },
                                id: function() {
                                    return e
                                },
                                read: function() {
                                    return t.read()
                                }
                            })]
                        }
                    }
                    ))
                }
                ))
            }
            ,
            this.detach = function(e) {
                e && o.privStreams[e] && (o.privStreams[e].close(),
                delete o.privStreams[e],
                o.onEvent(new s.AudioStreamNodeDetachedEvent(o.privId,e)))
            }
            ,
            this.turnOff = function() {
                for (var e in o.privStreams)
                    if (e) {
                        var t = o.privStreams[e];
                        t && !t.isClosed && t.close()
                    }
                return o.onEvent(new s.AudioSourceOffEvent(o.privId)),
                Promise.resolve()
            }
            ,
            this.onEvent = function(e) {
                o.privEvents.onEvent(e),
                s.Events.instance.onEvent(e)
            }
            ,
            this.privId = r || s.createNoDashGuid(),
            this.privEvents = new s.EventSource,
            this.privSource = e,
            "undefined" != typeof window && "undefined" != typeof Blob && this.privSource instanceof Blob ? this.privFilename = e.name : this.privFilename = t || "unknown.wav",
            this.privAudioFormatPromise = this.readHeader()
        }
        return Object.defineProperty(e.prototype, "format", {
            get: function() {
                return this.privAudioFormatPromise
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "blob", {
            get: function() {
                return Promise.resolve(this.privSource)
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "events", {
            get: function() {
                return this.privEvents
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "deviceInfo", {
            get: function() {
                return this.privAudioFormatPromise.then((function(e) {
                    return Promise.resolve({
                        bitspersample: e.bitsPerSample,
                        channelcount: e.channels,
                        connectivity: o.connectivity.Unknown,
                        manufacturer: "Speech SDK",
                        model: "File",
                        samplerate: e.samplesPerSec,
                        type: o.type.File
                    })
                }
                ))
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.readHeader = function() {
            var e = this
              , t = this.privSource.slice(0, 512)
              , r = new s.Deferred
              , n = function(t) {
                var n = new DataView(t)
                  , i = function(e) {
                    return String.fromCharCode(n.getUint8(e), n.getUint8(e + 1), n.getUint8(e + 2), n.getUint8(e + 3))
                };
                if ("RIFF" === i(0))
                    if ("WAVE" === i(8) && "fmt " === i(12)) {
                        for (var o = n.getInt32(16, !0), s = n.getUint16(22, !0), c = n.getUint32(24, !0), u = n.getUint16(34, !0), p = 36 + Math.max(o - 16, 0); "data" !== i(p); p += 2)
                            if (p > 504)
                                return void r.reject("Invalid WAV header in file, data block was not found");
                        e.privHeaderEnd = p + 8,
                        r.resolve(a.AudioStreamFormat.getWaveFormatPCM(c, u, s))
                    } else
                        r.reject("Invalid WAV header in file, WAVEfmt was not found");
                else
                    r.reject("Invalid WAV header in file, RIFF was not found")
            };
            if ("undefined" != typeof window && "undefined" != typeof Blob && t instanceof Blob) {
                var i = new FileReader;
                i.onload = function(e) {
                    var t = e.target.result;
                    n(t)
                }
                ,
                i.readAsArrayBuffer(t)
            } else {
                var o = t;
                n(o.buffer.slice(o.byteOffset, o.byteOffset + o.byteLength))
            }
            return r.promise
        }
        ,
        e.prototype.upload = function(e) {
            return n(this, void 0, void 0, (function() {
                var t, r, n, o, a, c, u, p, l = this;
                return i(this, (function(i) {
                    switch (i.label) {
                    case 0:
                        t = function(t) {
                            var r = "Error occurred while processing '" + l.privFilename + "'. " + t;
                            throw l.onEvent(new s.AudioStreamNodeErrorEvent(l.privId,e,r)),
                            new Error(r)
                        }
                        ,
                        i.label = 1;
                    case 1:
                        return i.trys.push([1, 4, , 5]),
                        [4, this.turnOn()];
                    case 2:
                        return i.sent(),
                        [4, this.privAudioFormatPromise];
                    case 3:
                        return r = i.sent(),
                        n = new s.ChunkedArrayBufferStream(r.avgBytesPerSec / 10,e),
                        this.privStreams[e] = n,
                        o = this.privSource.slice(this.privHeaderEnd),
                        a = function(e) {
                            n.isClosed || (n.writeStreamChunk({
                                buffer: e,
                                isEnd: !1,
                                timeReceived: Date.now()
                            }),
                            n.close())
                        }
                        ,
                        "undefined" != typeof window && "undefined" != typeof Blob && o instanceof Blob ? ((c = new FileReader).onerror = function(e) {
                            t(e.toString())
                        }
                        ,
                        c.onload = function(e) {
                            var t = e.target.result;
                            a(t)
                        }
                        ,
                        c.readAsArrayBuffer(o)) : a((u = o).buffer.slice(u.byteOffset, u.byteOffset + u.byteLength)),
                        [2, n];
                    case 4:
                        return p = i.sent(),
                        t(p),
                        [3, 5];
                    case 5:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e
    }();
    t.FileAudioSource = c
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.PcmRecorder = void 0;
    var n = r(4)
      , i = function() {
        function e(e) {
            var t = this;
            this.record = function(e, r, i) {
                var o = new n.RiffPcmEncoder(e.sampleRate,16e3)
                  , s = e.createMediaStreamSource(r);
                if (!t.privSpeechProcessorScript) {
                    var a = new Blob(["class SP extends AudioWorkletProcessor {\n                constructor(options) {\n                  super(options);\n                }\n                process(inputs, outputs) {\n                  const input = inputs[0];\n                  const output = [];\n                  for (let channel = 0; channel < input.length; channel += 1) {\n                    output[channel] = input[channel];\n                  }\n                  this.port.postMessage(output[0]);\n                  return true;\n                }\n              }\n              registerProcessor('speech-processor', SP);"],{
                        type: "application/javascript; charset=utf-8"
                    });
                    t.privSpeechProcessorScript = URL.createObjectURL(a)
                }
                if (!t.privSpeechProcessorScript || !e.audioWorklet)
                    throw new Error("Unable to start audio worklet node for PCMRecorder");
                e.audioWorklet.addModule(t.privSpeechProcessorScript).then((function() {
                    var n = new AudioWorkletNode(e,"speech-processor");
                    n.port.onmessage = function(e) {
                        var t = e.data;
                        if (i && !i.isClosed) {
                            var r = o.encode(t);
                            r && (i.writeStreamChunk({
                                buffer: r,
                                isEnd: !1,
                                timeReceived: Date.now()
                            }),
                            !1)
                        }
                    }
                    ,
                    s.connect(n),
                    n.connect(e.destination),
                    t.privMediaResources = {
                        scriptProcessorNode: n,
                        source: s,
                        stream: r
                    }
                }
                )).catch((function() {
                    var n = function() {
                        var t = 0;
                        try {
                            return e.createScriptProcessor(t, 1, 1)
                        } catch (n) {
                            t = 2048;
                            for (var r = e.sampleRate; t < 16384 && r >= 32e3; )
                                t <<= 1,
                                r >>= 1;
                            return e.createScriptProcessor(t, 1, 1)
                        }
                    }();
                    n.onaudioprocess = function(e) {
                        var t = e.inputBuffer.getChannelData(0);
                        if (i && !i.isClosed) {
                            var r = o.encode(t);
                            r && (i.writeStreamChunk({
                                buffer: r,
                                isEnd: !1,
                                timeReceived: Date.now()
                            }),
                            !1)
                        }
                    }
                    ,
                    s.connect(n),
                    n.connect(e.destination),
                    t.privMediaResources = {
                        scriptProcessorNode: n,
                        source: s,
                        stream: r
                    }
                }
                ))
            }
            ,
            this.releaseMediaResources = function(e) {
                t.privMediaResources && (t.privMediaResources.scriptProcessorNode && (t.privMediaResources.scriptProcessorNode.disconnect(e.destination),
                t.privMediaResources.scriptProcessorNode = null),
                t.privMediaResources.source && (t.privMediaResources.source.disconnect(),
                t.privStopInputOnRelease && t.privMediaResources.stream.getTracks().forEach((function(e) {
                    return e.stop()
                }
                )),
                t.privMediaResources.source = null))
            }
            ,
            this.privStopInputOnRelease = e
        }
        return e.prototype.setWorkletUrl = function(e) {
            this.privSpeechProcessorScript = e
        }
        ,
        e
    }();
    t.PcmRecorder = i
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
      , i = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.WebsocketConnection = void 0;
    var o = r(4)
      , s = r(232)
      , a = function() {
        function e(e, t, r, n, i, a, c) {
            var u = this;
            if (void 0 === a && (a = !1),
            this.privIsDisposed = !1,
            this.isDisposed = function() {
                return u.privIsDisposed
            }
            ,
            this.state = function() {
                return u.privConnectionMessageAdapter.state
            }
            ,
            this.open = function() {
                return u.privConnectionMessageAdapter.open()
            }
            ,
            this.send = function(e) {
                return u.privConnectionMessageAdapter.send(e)
            }
            ,
            this.read = function() {
                return u.privConnectionMessageAdapter.read()
            }
            ,
            !e)
                throw new o.ArgumentNullError("uri");
            if (!n)
                throw new o.ArgumentNullError("messageFormatter");
            this.privMessageFormatter = n;
            var p = ""
              , l = 0;
            if (t)
                for (var f in t) {
                    if (f)
                        p += 0 === l && -1 === e.indexOf("?") ? "?" : "&",
                        p += f + "=" + encodeURIComponent(t[f]),
                        l++
                }
            if (r)
                for (var h in r) {
                    if (h)
                        p += 0 === l && -1 === e.indexOf("?") ? "?" : "&",
                        p += h + "=" + encodeURIComponent(r[h]),
                        l++
                }
            this.privUri = e + p,
            this.privId = c || o.createNoDashGuid(),
            this.privConnectionMessageAdapter = new s.WebsocketMessageAdapter(this.privUri,this.id,this.privMessageFormatter,i,r,a)
        }
        return e.prototype.dispose = function() {
            return n(this, void 0, void 0, (function() {
                return i(this, (function(e) {
                    switch (e.label) {
                    case 0:
                        return this.privIsDisposed = !0,
                        this.privConnectionMessageAdapter ? [4, this.privConnectionMessageAdapter.close()] : [3, 2];
                    case 1:
                        e.sent(),
                        e.label = 2;
                    case 2:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        Object.defineProperty(e.prototype, "id", {
            get: function() {
                return this.privId
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "events", {
            get: function() {
                return this.privConnectionMessageAdapter.events
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.WebsocketConnection = a
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
      , i = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
      , o = this && this.__importDefault || function(e) {
        return e && e.__esModule ? e : {
            default: e
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.WebsocketMessageAdapter = void 0;
    var s = r(55)
      , a = r(4)
      , c = o(r(233))
      , u = r(234)
      , p = function() {
        function e(t, r, n, i, o, p) {
            var l = this;
            if (this.open = function() {
                if (l.privConnectionState === a.ConnectionState.Disconnected)
                    return Promise.reject("Cannot open a connection that is in " + l.privConnectionState + " state");
                if (l.privConnectionEstablishDeferral)
                    return l.privConnectionEstablishDeferral.promise;
                l.privConnectionEstablishDeferral = new a.Deferred,
                l.privCertificateValidatedDeferral = new a.Deferred,
                l.privConnectionState = a.ConnectionState.Connecting;
                try {
                    if ("undefined" == typeof WebSocket || e.forceNpmWebSocket) {
                        var t = {
                            headers: l.privHeaders,
                            perMessageDeflate: l.privEnableCompression
                        };
                        l.privCertificateValidatedDeferral.resolve();
                        var r = new u.CertCheckAgent(l.proxyInfo);
                        t.agent = r.GetAgent(),
                        l.privWebsocketClient = new c.default(l.privUri,t)
                    } else
                        l.privCertificateValidatedDeferral.resolve(),
                        l.privWebsocketClient = new WebSocket(l.privUri);
                    l.privWebsocketClient.binaryType = "arraybuffer",
                    l.privReceivingMessageQueue = new a.Queue,
                    l.privDisconnectDeferral = new a.Deferred,
                    l.privSendMessageQueue = new a.Queue,
                    l.processSendQueue().catch((function(e) {
                        a.Events.instance.onEvent(new a.BackgroundEvent(e))
                    }
                    ))
                } catch (e) {
                    return l.privConnectionEstablishDeferral.resolve(new a.ConnectionOpenResponse(500,e)),
                    l.privConnectionEstablishDeferral.promise
                }
                return l.onEvent(new a.ConnectionStartEvent(l.privConnectionId,l.privUri)),
                l.privWebsocketClient.onopen = function(e) {
                    l.privCertificateValidatedDeferral.promise.then((function() {
                        l.privConnectionState = a.ConnectionState.Connected,
                        l.onEvent(new a.ConnectionEstablishedEvent(l.privConnectionId)),
                        l.privConnectionEstablishDeferral.resolve(new a.ConnectionOpenResponse(200,""))
                    }
                    ), (function(e) {
                        l.privConnectionEstablishDeferral.reject(e)
                    }
                    ))
                }
                ,
                l.privWebsocketClient.onerror = function(e) {
                    l.onEvent(new a.ConnectionErrorEvent(l.privConnectionId,e.message,e.type)),
                    l.privLastErrorReceived = e.message
                }
                ,
                l.privWebsocketClient.onclose = function(e) {
                    l.privConnectionState === a.ConnectionState.Connecting ? (l.privConnectionState = a.ConnectionState.Disconnected,
                    l.privConnectionEstablishDeferral.resolve(new a.ConnectionOpenResponse(e.code,e.reason + " " + l.privLastErrorReceived))) : (l.privConnectionState = a.ConnectionState.Disconnected,
                    l.privWebsocketClient = null,
                    l.onEvent(new a.ConnectionClosedEvent(l.privConnectionId,e.code,e.reason))),
                    l.onClose(e.code, e.reason).catch((function(e) {
                        a.Events.instance.onEvent(new a.BackgroundEvent(e))
                    }
                    ))
                }
                ,
                l.privWebsocketClient.onmessage = function(e) {
                    var t = (new Date).toISOString();
                    if (l.privConnectionState === a.ConnectionState.Connected) {
                        var r = new a.Deferred;
                        if (l.privReceivingMessageQueue.enqueueFromPromise(r.promise),
                        e.data instanceof ArrayBuffer) {
                            var n = new a.RawWebsocketMessage(a.MessageType.Binary,e.data);
                            l.privMessageFormatter.toConnectionMessage(n).then((function(e) {
                                l.onEvent(new a.ConnectionMessageReceivedEvent(l.privConnectionId,t,e)),
                                r.resolve(e)
                            }
                            ), (function(e) {
                                r.reject("Invalid binary message format. Error: " + e)
                            }
                            ))
                        } else {
                            n = new a.RawWebsocketMessage(a.MessageType.Text,e.data);
                            l.privMessageFormatter.toConnectionMessage(n).then((function(e) {
                                l.onEvent(new a.ConnectionMessageReceivedEvent(l.privConnectionId,t,e)),
                                r.resolve(e)
                            }
                            ), (function(e) {
                                r.reject("Invalid text message format. Error: " + e)
                            }
                            ))
                        }
                    }
                }
                ,
                l.privConnectionEstablishDeferral.promise
            }
            ,
            this.send = function(e) {
                if (l.privConnectionState !== a.ConnectionState.Connected)
                    return Promise.reject("Cannot send on connection that is in " + a.ConnectionState[l.privConnectionState] + " state");
                var t = new a.Deferred
                  , r = new a.Deferred;
                return l.privSendMessageQueue.enqueueFromPromise(r.promise),
                l.privMessageFormatter.fromConnectionMessage(e).then((function(n) {
                    r.resolve({
                        Message: e,
                        RawWebsocketMessage: n,
                        sendStatusDeferral: t
                    })
                }
                ), (function(e) {
                    r.reject("Error formatting the message. " + e)
                }
                )),
                t.promise
            }
            ,
            this.read = function() {
                return l.privConnectionState !== a.ConnectionState.Connected ? Promise.reject("Cannot read on connection that is in " + l.privConnectionState + " state") : l.privReceivingMessageQueue.dequeue()
            }
            ,
            this.close = function(e) {
                return l.privWebsocketClient ? (l.privConnectionState !== a.ConnectionState.Disconnected && l.privWebsocketClient.close(1e3, e || "Normal closure by client"),
                l.privDisconnectDeferral.promise) : Promise.resolve()
            }
            ,
            this.sendRawMessage = function(e) {
                try {
                    return e ? (l.onEvent(new a.ConnectionMessageSentEvent(l.privConnectionId,(new Date).toISOString(),e.Message)),
                    l.isWebsocketOpen ? (l.privWebsocketClient.send(e.RawWebsocketMessage.payload),
                    Promise.resolve()) : Promise.reject("websocket send error: Websocket not ready " + l.privConnectionId + " " + e.Message.id + " " + (new Error).stack)) : Promise.resolve()
                } catch (e) {
                    return Promise.reject("websocket send error: " + e)
                }
            }
            ,
            this.onEvent = function(e) {
                l.privConnectionEvents.onEvent(e),
                a.Events.instance.onEvent(e)
            }
            ,
            !t)
                throw new a.ArgumentNullError("uri");
            if (!n)
                throw new a.ArgumentNullError("messageFormatter");
            this.proxyInfo = i,
            this.privConnectionEvents = new a.EventSource,
            this.privConnectionId = r,
            this.privMessageFormatter = n,
            this.privConnectionState = a.ConnectionState.None,
            this.privUri = t,
            this.privHeaders = o,
            this.privEnableCompression = p,
            this.privHeaders[s.HeaderNames.ConnectionId] = this.privConnectionId,
            this.privLastErrorReceived = ""
        }
        return Object.defineProperty(e.prototype, "state", {
            get: function() {
                return this.privConnectionState
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "events", {
            get: function() {
                return this.privConnectionEvents
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.onClose = function(e, t) {
            return n(this, void 0, void 0, (function() {
                var r;
                return i(this, (function(n) {
                    switch (n.label) {
                    case 0:
                        return r = "Connection closed. " + e + ": " + t,
                        this.privConnectionState = a.ConnectionState.Disconnected,
                        this.privDisconnectDeferral.resolve(),
                        [4, this.privReceivingMessageQueue.drainAndDispose((function(e) {}
                        ), r)];
                    case 1:
                        return n.sent(),
                        [4, this.privSendMessageQueue.drainAndDispose((function(e) {
                            e.sendStatusDeferral.reject(r)
                        }
                        ), r)];
                    case 2:
                        return n.sent(),
                        [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        e.prototype.processSendQueue = function() {
            return n(this, void 0, void 0, (function() {
                var e, t;
                return i(this, (function(r) {
                    switch (r.label) {
                    case 0:
                        return [4, this.privSendMessageQueue.dequeue()];
                    case 1:
                        if (!(e = r.sent()))
                            return [2];
                        r.label = 2;
                    case 2:
                        return r.trys.push([2, 4, , 5]),
                        [4, this.sendRawMessage(e)];
                    case 3:
                        return r.sent(),
                        e.sendStatusDeferral.resolve(),
                        [3, 5];
                    case 4:
                        return t = r.sent(),
                        e.sendStatusDeferral.reject(t),
                        [3, 5];
                    case 5:
                        return [3, 0];
                    case 6:
                        return [2]
                    }
                }
                ))
            }
            ))
        }
        ,
        Object.defineProperty(e.prototype, "isWebsocketOpen", {
            get: function() {
                return this.privWebsocketClient && this.privWebsocketClient.readyState === this.privWebsocketClient.OPEN
            },
            enumerable: !1,
            configurable: !0
        }),
        e.forceNpmWebSocket = !1,
        e
    }();
    t.WebsocketMessageAdapter = p
}
, function(e, t) {}
, function(e, t, r) {
    "use strict";
    (function(e, n) {
        var i = this && this.__assign || function() {
            return (i = Object.assign || function(e) {
                for (var t, r = 1, n = arguments.length; r < n; r++)
                    for (var i in t = arguments[r])
                        Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
                return e
            }
            ).apply(this, arguments)
        }
          , o = this && this.__createBinding || (Object.create ? function(e, t, r, n) {
            void 0 === n && (n = r),
            Object.defineProperty(e, n, {
                enumerable: !0,
                get: function() {
                    return t[r]
                }
            })
        }
        : function(e, t, r, n) {
            void 0 === n && (n = r),
            e[n] = t[r]
        }
        )
          , s = this && this.__setModuleDefault || (Object.create ? function(e, t) {
            Object.defineProperty(e, "default", {
                enumerable: !0,
                value: t
            })
        }
        : function(e, t) {
            e.default = t
        }
        )
          , a = this && this.__importStar || function(e) {
            if (e && e.__esModule)
                return e;
            var t = {};
            if (null != e)
                for (var r in e)
                    "default" !== r && Object.hasOwnProperty.call(e, r) && o(t, e, r);
            return s(t, e),
            t
        }
          , c = this && this.__awaiter || function(e, t, r, n) {
            return new (r || (r = Promise))((function(i, o) {
                function s(e) {
                    try {
                        c(n.next(e))
                    } catch (e) {
                        o(e)
                    }
                }
                function a(e) {
                    try {
                        c(n.throw(e))
                    } catch (e) {
                        o(e)
                    }
                }
                function c(e) {
                    var t;
                    e.done ? i(e.value) : (t = e.value,
                    t instanceof r ? t : new r((function(e) {
                        e(t)
                    }
                    ))).then(s, a)
                }
                c((n = n.apply(e, t || [])).next())
            }
            ))
        }
          , u = this && this.__generator || function(e, t) {
            var r, n, i, o, s = {
                label: 0,
                sent: function() {
                    if (1 & i[0])
                        throw i[1];
                    return i[1]
                },
                trys: [],
                ops: []
            };
            return o = {
                next: a(0),
                throw: a(1),
                return: a(2)
            },
            "function" == typeof Symbol && (o[Symbol.iterator] = function() {
                return this
            }
            ),
            o;
            function a(o) {
                return function(a) {
                    return function(o) {
                        if (r)
                            throw new TypeError("Generator is already executing.");
                        for (; s; )
                            try {
                                if (r = 1,
                                n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                                0) : n.next) && !(i = i.call(n, o[1])).done)
                                    return i;
                                switch (n = 0,
                                i && (o = [2 & o[0], i.value]),
                                o[0]) {
                                case 0:
                                case 1:
                                    i = o;
                                    break;
                                case 4:
                                    return s.label++,
                                    {
                                        value: o[1],
                                        done: !1
                                    };
                                case 5:
                                    s.label++,
                                    n = o[1],
                                    o = [0];
                                    continue;
                                case 7:
                                    o = s.ops.pop(),
                                    s.trys.pop();
                                    continue;
                                default:
                                    if (!(i = s.trys,
                                    (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                        s = 0;
                                        continue
                                    }
                                    if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                        s.label = o[1];
                                        break
                                    }
                                    if (6 === o[0] && s.label < i[1]) {
                                        s.label = i[1],
                                        i = o;
                                        break
                                    }
                                    if (i && s.label < i[2]) {
                                        s.label = i[2],
                                        s.ops.push(o);
                                        break
                                    }
                                    i[2] && s.ops.pop(),
                                    s.trys.pop();
                                    continue
                                }
                                o = t.call(e, s)
                            } catch (e) {
                                o = [6, e],
                                n = 0
                            } finally {
                                r = i = 0
                            }
                        if (5 & o[0])
                            throw o[1];
                        return {
                            value: o[0] ? o[1] : void 0,
                            done: !0
                        }
                    }([o, a])
                }
            }
        }
          , p = this && this.__importDefault || function(e) {
            return e && e.__esModule ? e : {
                default: e
            }
        }
        ;
        Object.defineProperty(t, "__esModule", {
            value: !0
        }),
        t.CertCheckAgent = void 0;
        var l = a(r(236))
          , f = a(r(237))
          , h = a(r(240))
          , v = r(4)
          , d = p(r(241))
          , y = p(r(242))
          , g = p(r(243))
          , m = a(r(244))
          , b = r(49)
          , S = function() {
            function t(r) {
                r && (this.privProxyInfo = r),
                t.privDiskCache || (t.privDiskCache = new y.default("microsoft-cognitiveservices-speech-sdk-cache",{
                    supportBuffer: !0,
                    location: void 0 !== e && e.env.SPEECH_OCSP_CACHE_ROOT ? e.env.SPEECH_OCSP_CACHE_ROOT : void 0
                }))
            }
            return t.forceReinitDiskCache = function() {
                t.privDiskCache = void 0,
                t.privMemCache = {}
            }
            ,
            t.prototype.GetAgent = function(e) {
                var t = new d.default.Agent(this.CreateConnection);
                if (void 0 !== this.privProxyInfo && void 0 !== this.privProxyInfo.HostName && this.privProxyInfo.Port > 0) {
                    t.privProxyInfo = this.privProxyInfo
                }
                return t
            }
            ,
            t.GetProxyAgent = function(e) {
                var t = {
                    host: e.HostName,
                    port: e.Port
                };
                return e.UserName ? t.headers = {
                    "Proxy-Authentication": "Basic " + new n(e.UserName + ":" + (void 0 === e.Password) ? "" : e.Password).toString("base64")
                } : t.headers = {},
                t.headers.requestOCSP = "true",
                new g.default(t)
            }
            ,
            t.OCSPCheck = function(e, r) {
                return c(this, void 0, void 0, (function() {
                    var n, i, o, s, a, p = this;
                    return u(this, (function(l) {
                        switch (l.label) {
                        case 0:
                            return o = !1,
                            [4, e];
                        case 1:
                            return (s = l.sent()).cork(),
                            a = s,
                            [2, new Promise((function(e, l) {
                                s.on("OCSPResponse", (function(e) {
                                    e && (p.onEvent(new v.OCSPStapleReceivedEvent),
                                    i = e)
                                }
                                )),
                                s.on("error", (function(e) {
                                    o || (o = !0,
                                    s.destroy(),
                                    l(e))
                                }
                                )),
                                a.on("secure", (function() {
                                    return c(p, void 0, void 0, (function() {
                                        var c, p, f, v, d;
                                        return u(this, (function(u) {
                                            switch (u.label) {
                                            case 0:
                                                c = a.getPeerCertificate(!0),
                                                u.label = 1;
                                            case 1:
                                                return u.trys.push([1, 6, , 7]),
                                                [4, this.GetIssuer(c)];
                                            case 2:
                                                return p = u.sent(),
                                                n = h.request.generate(c.raw, p.raw),
                                                f = n.id.toString("hex"),
                                                i ? [3, 4] : [4, t.GetResponseFromCache(f, n, r)];
                                            case 3:
                                                v = u.sent(),
                                                i = v,
                                                u.label = 4;
                                            case 4:
                                                return [4, this.VerifyOCSPResponse(i, n, r)];
                                            case 5:
                                                return u.sent(),
                                                s.uncork(),
                                                o = !0,
                                                e(s),
                                                [3, 7];
                                            case 6:
                                                return d = u.sent(),
                                                s.destroy(),
                                                o = !0,
                                                l(d),
                                                [3, 7];
                                            case 7:
                                                return [2]
                                            }
                                        }
                                        ))
                                    }
                                    ))
                                }
                                ))
                            }
                            ))]
                        }
                    }
                    ))
                }
                ))
            }
            ,
            t.GetIssuer = function(e) {
                return e.issuerCertificate ? Promise.resolve(e.issuerCertificate) : new Promise((function(t, r) {
                    new h.Agent({}).fetchIssuer(e, null, (function(e, n) {
                        e ? r(e) : t(n)
                    }
                    ))
                }
                ))
            }
            ,
            t.GetResponseFromCache = function(e, r, n) {
                return c(this, void 0, void 0, (function() {
                    var i, o, s, a, c, p, l, f = this;
                    return u(this, (function(u) {
                        switch (u.label) {
                        case 0:
                            if ((i = t.privMemCache[e]) && this.onEvent(new v.OCSPMemoryCacheHitEvent(e)),
                            i)
                                return [3, 4];
                            u.label = 1;
                        case 1:
                            return u.trys.push([1, 3, , 4]),
                            [4, t.privDiskCache.get(e)];
                        case 2:
                            return (o = u.sent()).isCached && (t.onEvent(new v.OCSPDiskCacheHitEvent(e)),
                            t.StoreMemoryCacheEntry(e, o.value),
                            i = o.value),
                            [3, 4];
                        case 3:
                            return u.sent(),
                            i = null,
                            [3, 4];
                        case 4:
                            if (!i)
                                return [2, i];
                            try {
                                if (s = h.utils.parseResponse(i),
                                (a = s.value.tbsResponseData).responses.length < 1)
                                    return this.onEvent(new v.OCSPCacheFetchErrorEvent(e,"Not enough data in cached response")),
                                    [2];
                                c = a.responses[0].thisUpdate,
                                (p = a.responses[0].nextUpdate) < Date.now() + this.testTimeOffset - 6e4 ? (this.onEvent(new v.OCSPCacheEntryExpiredEvent(e,p)),
                                i = null) : (l = Math.min(864e5, (p - c) / 2),
                                p - (Date.now() + this.testTimeOffset) < l ? (this.onEvent(new v.OCSPCacheEntryNeedsRefreshEvent(e,c,p)),
                                this.UpdateCache(r, n).catch((function(t) {
                                    f.onEvent(new b.OCSPCacheUpdateErrorEvent(e,t.toString()))
                                }
                                ))) : this.onEvent(new v.OCSPCacheHitEvent(e,c,p)))
                            } catch (t) {
                                this.onEvent(new v.OCSPCacheFetchErrorEvent(e,t)),
                                i = null
                            }
                            return i || this.onEvent(new v.OCSPCacheMissEvent(e)),
                            [2, i]
                        }
                    }
                    ))
                }
                ))
            }
            ,
            t.VerifyOCSPResponse = function(e, r, n) {
                return c(this, void 0, void 0, (function() {
                    var i, o = this;
                    return u(this, (function(s) {
                        switch (s.label) {
                        case 0:
                            return i = e,
                            r.certID.toString("hex"),
                            i ? [3, 2] : [4, t.GetOCSPResponse(r, n)];
                        case 1:
                            i = s.sent(),
                            s.label = 2;
                        case 2:
                            return [2, new Promise((function(s, a) {
                                h.verify({
                                    request: r,
                                    response: i
                                }, (function(c, u) {
                                    c ? (t.onEvent(new v.OCSPVerificationFailedEvent(r.id.toString("hex"),c)),
                                    e ? o.VerifyOCSPResponse(null, r, n).then((function() {
                                        s()
                                    }
                                    ), (function(e) {
                                        a(e)
                                    }
                                    )) : a(c)) : (e || t.StoreCacheEntry(r.id.toString("hex"), i),
                                    s())
                                }
                                ))
                            }
                            ))]
                        }
                    }
                    ))
                }
                ))
            }
            ,
            t.UpdateCache = function(e, t) {
                return c(this, void 0, void 0, (function() {
                    var r, n;
                    return u(this, (function(i) {
                        switch (i.label) {
                        case 0:
                            return r = e.id.toString("hex"),
                            this.onEvent(new v.OCSPCacheUpdateNeededEvent(r)),
                            [4, this.GetOCSPResponse(e, t)];
                        case 1:
                            return n = i.sent(),
                            this.StoreCacheEntry(r, n),
                            this.onEvent(new v.OCSPCacheUpdatehCompleteEvent(e.id.toString("hex"))),
                            [2]
                        }
                    }
                    ))
                }
                ))
            }
            ,
            t.StoreCacheEntry = function(e, t) {
                this.StoreMemoryCacheEntry(e, t),
                this.StoreDiskCacheEntry(e, t)
            }
            ,
            t.StoreMemoryCacheEntry = function(e, t) {
                this.privMemCache[e] = t,
                this.onEvent(new v.OCSPMemoryCacheStoreEvent(e))
            }
            ,
            t.StoreDiskCacheEntry = function(e, t) {
                var r = this;
                this.privDiskCache.set(e, t).then((function() {
                    r.onEvent(new v.OCSPDiskCacheStoreEvent(e))
                }
                ))
            }
            ,
            t.GetOCSPResponse = function(e, r) {
                var n = this
                  , o = {};
                if (r) {
                    var s = t.GetProxyAgent(r);
                    o.agent = s
                }
                return new Promise((function(t, r) {
                    h.utils.getAuthorityInfo(e.cert, "1.3.6.1.5.5.7.48.1", (function(s, a) {
                        if (s)
                            r(s);
                        else {
                            var c = f.default(a);
                            c.path = c.pathname,
                            o = i(i({}, o), c),
                            h.utils.getResponse(o, e.data, (function(i, o) {
                                i ? r(i) : (n.onEvent(new v.OCSPResponseRetrievedEvent(e.certID.toString("hex"))),
                                t(o))
                            }
                            ))
                        }
                    }
                    ))
                }
                ))
            }
            ,
            t.prototype.CreateConnection = function(r, n) {
                var o, s = void 0 !== e && "0" !== e.env.NODE_TLS_REJECT_UNAUTHORIZED && "0" !== e.env.SPEECH_CONDUCT_OCSP_CHECK && n.secureEndpoint;
                if (n = i(i({}, n), {
                    requestOCSP: !t.forceDisableOCSPStapling,
                    servername: n.host
                }),
                this.privProxyInfo) {
                    var a = t.GetProxyAgent(this.privProxyInfo);
                    o = new Promise((function(e, t) {
                        a.callback(r, n, (function(r, n) {
                            r ? t(r) : e(n)
                        }
                        ))
                    }
                    ))
                } else
                    o = n.secureEndpoint ? Promise.resolve(l.connect(n)) : Promise.resolve(m.connect(n));
                return s ? t.OCSPCheck(o, this.privProxyInfo) : o
            }
            ,
            t.testTimeOffset = 0,
            t.forceDisableOCSPStapling = !1,
            t.privMemCache = {},
            t.onEvent = function(e) {
                v.Events.instance.onEvent(e)
            }
            ,
            t
        }();
        t.CertCheckAgent = S
    }
    ).call(this, r(235), r(67).Buffer)
}
, function(e, t) {
    var r, n, i = e.exports = {};
    function o() {
        throw new Error("setTimeout has not been defined")
    }
    function s() {
        throw new Error("clearTimeout has not been defined")
    }
    function a(e) {
        if (r === setTimeout)
            return setTimeout(e, 0);
        if ((r === o || !r) && setTimeout)
            return r = setTimeout,
            setTimeout(e, 0);
        try {
            return r(e, 0)
        } catch (t) {
            try {
                return r.call(null, e, 0)
            } catch (t) {
                return r.call(this, e, 0)
            }
        }
    }
    !function() {
        try {
            r = "function" == typeof setTimeout ? setTimeout : o
        } catch (e) {
            r = o
        }
        try {
            n = "function" == typeof clearTimeout ? clearTimeout : s
        } catch (e) {
            n = s
        }
    }();
    var c, u = [], p = !1, l = -1;
    function f() {
        p && c && (p = !1,
        c.length ? u = c.concat(u) : l = -1,
        u.length && h())
    }
    function h() {
        if (!p) {
            var e = a(f);
            p = !0;
            for (var t = u.length; t; ) {
                for (c = u,
                u = []; ++l < t; )
                    c && c[l].run();
                l = -1,
                t = u.length
            }
            c = null,
            p = !1,
            function(e) {
                if (n === clearTimeout)
                    return clearTimeout(e);
                if ((n === s || !n) && clearTimeout)
                    return n = clearTimeout,
                    clearTimeout(e);
                try {
                    n(e)
                } catch (t) {
                    try {
                        return n.call(null, e)
                    } catch (t) {
                        return n.call(this, e)
                    }
                }
            }(e)
        }
    }
    function v(e, t) {
        this.fun = e,
        this.array = t
    }
    function d() {}
    i.nextTick = function(e) {
        var t = new Array(arguments.length - 1);
        if (arguments.length > 1)
            for (var r = 1; r < arguments.length; r++)
                t[r - 1] = arguments[r];
        u.push(new v(e,t)),
        1 !== u.length || p || a(h)
    }
    ,
    v.prototype.run = function() {
        this.fun.apply(null, this.array)
    }
    ,
    i.title = "browser",
    i.browser = !0,
    i.env = {},
    i.argv = [],
    i.version = "",
    i.versions = {},
    i.on = d,
    i.addListener = d,
    i.once = d,
    i.off = d,
    i.removeListener = d,
    i.removeAllListeners = d,
    i.emit = d,
    i.prependListener = d,
    i.prependOnceListener = d,
    i.listeners = function(e) {
        return []
    }
    ,
    i.binding = function(e) {
        throw new Error("process.binding is not supported")
    }
    ,
    i.cwd = function() {
        return "/"
    }
    ,
    i.chdir = function(e) {
        throw new Error("process.chdir is not supported")
    }
    ,
    i.umask = function() {
        return 0
    }
}
, function(e, t) {}
, function(e, t, r) {
    "use strict";
    (function(t) {
        var n = r(238)
          , i = r(239)
          , o = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//
          , s = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i
          , a = /^[a-zA-Z]:/
          , c = new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");
        function u(e) {
            return (e || "").toString().replace(c, "")
        }
        var p = [["#", "hash"], ["?", "query"], function(e, t) {
            return h(t.protocol) ? e.replace(/\\/g, "/") : e
        }
        , ["/", "pathname"], ["@", "auth", 1], [NaN, "host", void 0, 1, 1], [/:(\d+)$/, "port", void 0, 1], [NaN, "hostname", void 0, 1, 1]]
          , l = {
            hash: 1,
            query: 1
        };
        function f(e) {
            var r, n = ("undefined" != typeof window ? window : void 0 !== t ? t : "undefined" != typeof self ? self : {}).location || {}, i = {}, s = typeof (e = e || n);
            if ("blob:" === e.protocol)
                i = new d(unescape(e.pathname),{});
            else if ("string" === s)
                for (r in i = new d(e,{}),
                l)
                    delete i[r];
            else if ("object" === s) {
                for (r in e)
                    r in l || (i[r] = e[r]);
                void 0 === i.slashes && (i.slashes = o.test(e.href))
            }
            return i
        }
        function h(e) {
            return "file:" === e || "ftp:" === e || "http:" === e || "https:" === e || "ws:" === e || "wss:" === e
        }
        function v(e, t) {
            e = u(e),
            t = t || {};
            var r, n = s.exec(e), i = n[1] ? n[1].toLowerCase() : "", o = !!n[2], a = !!n[3], c = 0;
            return o ? a ? (r = n[2] + n[3] + n[4],
            c = n[2].length + n[3].length) : (r = n[2] + n[4],
            c = n[2].length) : a ? (r = n[3] + n[4],
            c = n[3].length) : r = n[4],
            "file:" === i ? c >= 2 && (r = r.slice(2)) : h(i) ? r = n[4] : i ? o && (r = r.slice(2)) : c >= 2 && h(t.protocol) && (r = n[4]),
            {
                protocol: i,
                slashes: o || h(i),
                slashesCount: c,
                rest: r
            }
        }
        function d(e, t, r) {
            if (e = u(e),
            !(this instanceof d))
                return new d(e,t,r);
            var o, s, c, l, y, g, m = p.slice(), b = typeof t, S = this, C = 0;
            for ("object" !== b && "string" !== b && (r = t,
            t = null),
            r && "function" != typeof r && (r = i.parse),
            o = !(s = v(e || "", t = f(t))).protocol && !s.slashes,
            S.slashes = s.slashes || o && t.slashes,
            S.protocol = s.protocol || t.protocol || "",
            e = s.rest,
            ("file:" === s.protocol && (2 !== s.slashesCount || a.test(e)) || !s.slashes && (s.protocol || s.slashesCount < 2 || !h(S.protocol))) && (m[3] = [/(.*)/, "pathname"]); C < m.length; C++)
                "function" != typeof (l = m[C]) ? (c = l[0],
                g = l[1],
                c != c ? S[g] = e : "string" == typeof c ? ~(y = e.indexOf(c)) && ("number" == typeof l[2] ? (S[g] = e.slice(0, y),
                e = e.slice(y + l[2])) : (S[g] = e.slice(y),
                e = e.slice(0, y))) : (y = c.exec(e)) && (S[g] = y[1],
                e = e.slice(0, y.index)),
                S[g] = S[g] || o && l[3] && t[g] || "",
                l[4] && (S[g] = S[g].toLowerCase())) : e = l(e, S);
            r && (S.query = r(S.query)),
            o && t.slashes && "/" !== S.pathname.charAt(0) && ("" !== S.pathname || "" !== t.pathname) && (S.pathname = function(e, t) {
                if ("" === e)
                    return t;
                for (var r = (t || "/").split("/").slice(0, -1).concat(e.split("/")), n = r.length, i = r[n - 1], o = !1, s = 0; n--; )
                    "." === r[n] ? r.splice(n, 1) : ".." === r[n] ? (r.splice(n, 1),
                    s++) : s && (0 === n && (o = !0),
                    r.splice(n, 1),
                    s--);
                return o && r.unshift(""),
                "." !== i && ".." !== i || r.push(""),
                r.join("/")
            }(S.pathname, t.pathname)),
            "/" !== S.pathname.charAt(0) && h(S.protocol) && (S.pathname = "/" + S.pathname),
            n(S.port, S.protocol) || (S.host = S.hostname,
            S.port = ""),
            S.username = S.password = "",
            S.auth && (l = S.auth.split(":"),
            S.username = l[0] || "",
            S.password = l[1] || ""),
            S.origin = "file:" !== S.protocol && h(S.protocol) && S.host ? S.protocol + "//" + S.host : "null",
            S.href = S.toString()
        }
        d.prototype = {
            set: function(e, t, r) {
                var o = this;
                switch (e) {
                case "query":
                    "string" == typeof t && t.length && (t = (r || i.parse)(t)),
                    o[e] = t;
                    break;
                case "port":
                    o[e] = t,
                    n(t, o.protocol) ? t && (o.host = o.hostname + ":" + t) : (o.host = o.hostname,
                    o[e] = "");
                    break;
                case "hostname":
                    o[e] = t,
                    o.port && (t += ":" + o.port),
                    o.host = t;
                    break;
                case "host":
                    o[e] = t,
                    /:\d+$/.test(t) ? (t = t.split(":"),
                    o.port = t.pop(),
                    o.hostname = t.join(":")) : (o.hostname = t,
                    o.port = "");
                    break;
                case "protocol":
                    o.protocol = t.toLowerCase(),
                    o.slashes = !r;
                    break;
                case "pathname":
                case "hash":
                    if (t) {
                        var s = "pathname" === e ? "/" : "#";
                        o[e] = t.charAt(0) !== s ? s + t : t
                    } else
                        o[e] = t;
                    break;
                default:
                    o[e] = t
                }
                for (var a = 0; a < p.length; a++) {
                    var c = p[a];
                    c[4] && (o[c[1]] = o[c[1]].toLowerCase())
                }
                return o.origin = "file:" !== o.protocol && h(o.protocol) && o.host ? o.protocol + "//" + o.host : "null",
                o.href = o.toString(),
                o
            },
            toString: function(e) {
                e && "function" == typeof e || (e = i.stringify);
                var t, r = this, n = r.protocol;
                n && ":" !== n.charAt(n.length - 1) && (n += ":");
                var o = n + (r.slashes || h(r.protocol) ? "//" : "");
                return r.username && (o += r.username,
                r.password && (o += ":" + r.password),
                o += "@"),
                o += r.host + r.pathname,
                (t = "object" == typeof r.query ? e(r.query) : r.query) && (o += "?" !== t.charAt(0) ? "?" + t : t),
                r.hash && (o += r.hash),
                o
            }
        },
        d.extractProtocol = v,
        d.location = f,
        d.trimLeft = u,
        d.qs = i,
        e.exports = d
    }
    ).call(this, r(68))
}
, function(e, t, r) {
    "use strict";
    e.exports = function(e, t) {
        if (t = t.split(":")[0],
        !(e = +e))
            return !1;
        switch (t) {
        case "http":
        case "ws":
            return 80 !== e;
        case "https":
        case "wss":
            return 443 !== e;
        case "ftp":
            return 21 !== e;
        case "gopher":
            return 70 !== e;
        case "file":
            return !1
        }
        return 0 !== e
    }
}
, function(e, t, r) {
    "use strict";
    var n = Object.prototype.hasOwnProperty;
    function i(e) {
        try {
            return decodeURIComponent(e.replace(/\+/g, " "))
        } catch (e) {
            return null
        }
    }
    function o(e) {
        try {
            return encodeURIComponent(e)
        } catch (e) {
            return null
        }
    }
    t.stringify = function(e, t) {
        t = t || "";
        var r, i, s = [];
        for (i in "string" != typeof t && (t = "?"),
        e)
            if (n.call(e, i)) {
                if ((r = e[i]) || null != r && !isNaN(r) || (r = ""),
                i = o(i),
                r = o(r),
                null === i || null === r)
                    continue;
                s.push(i + "=" + r)
            }
        return s.length ? t + s.join("&") : ""
    }
    ,
    t.parse = function(e) {
        for (var t, r = /([^=?#&]+)=?([^&]*)/g, n = {}; t = r.exec(e); ) {
            var o = i(t[1])
              , s = i(t[2]);
            null === o || null === s || o in n || (n[o] = s)
        }
        return n
    }
}
, function(e, t) {}
, function(e, t) {}
, function(e, t) {}
, function(e, t) {}
, function(e, t) {}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ReplayableAudioNode = void 0;
    var n = function() {
        function e(e, t) {
            var r = this;
            this.privBuffers = [],
            this.privReplayOffset = 0,
            this.privLastShrinkOffset = 0,
            this.privBufferStartOffset = 0,
            this.privBufferSerial = 0,
            this.privBufferedBytes = 0,
            this.privReplay = !1,
            this.privLastChunkAcquiredTime = 0,
            this.id = function() {
                return r.privAudioNode.id()
            }
            ,
            this.privAudioNode = e,
            this.privBytesPerSecond = t
        }
        return e.prototype.read = function() {
            var e = this;
            if (this.privReplay && 0 !== this.privBuffers.length) {
                var t = this.privReplayOffset - this.privBufferStartOffset
                  , r = Math.round(t * this.privBytesPerSecond * 1e-7);
                0 != r % 2 && r++;
                for (var n = 0; n < this.privBuffers.length && r >= this.privBuffers[n].chunk.buffer.byteLength; )
                    r -= this.privBuffers[n++].chunk.buffer.byteLength;
                if (n < this.privBuffers.length) {
                    var o = this.privBuffers[n].chunk.buffer.slice(r);
                    return this.privReplayOffset += o.byteLength / this.privBytesPerSecond * 1e7,
                    n === this.privBuffers.length - 1 && (this.privReplay = !1),
                    Promise.resolve({
                        buffer: o,
                        isEnd: !1,
                        timeReceived: this.privBuffers[n].chunk.timeReceived
                    })
                }
            }
            return this.privAudioNode.read().then((function(t) {
                return t && t.buffer && (e.privBuffers.push(new i(t,e.privBufferSerial++,e.privBufferedBytes)),
                e.privBufferedBytes += t.buffer.byteLength),
                t
            }
            ))
        }
        ,
        e.prototype.detach = function() {
            return this.privBuffers = void 0,
            this.privAudioNode.detach()
        }
        ,
        e.prototype.replay = function() {
            this.privBuffers && 0 !== this.privBuffers.length && (this.privReplay = !0,
            this.privReplayOffset = this.privLastShrinkOffset)
        }
        ,
        e.prototype.shrinkBuffers = function(e) {
            if (void 0 !== this.privBuffers && 0 !== this.privBuffers.length) {
                this.privLastShrinkOffset = e;
                for (var t = e - this.privBufferStartOffset, r = Math.round(t * this.privBytesPerSecond * 1e-7), n = 0; n < this.privBuffers.length && r >= this.privBuffers[n].chunk.buffer.byteLength; )
                    r -= this.privBuffers[n++].chunk.buffer.byteLength;
                this.privBufferStartOffset = Math.round(e - r / this.privBytesPerSecond * 1e7),
                this.privBuffers = this.privBuffers.slice(n)
            }
        }
        ,
        e.prototype.findTimeAtOffset = function(e) {
            if (e < this.privBufferStartOffset || void 0 === this.privBuffers)
                return 0;
            for (var t = 0, r = this.privBuffers; t < r.length; t++) {
                var n = r[t]
                  , i = n.byteOffset / this.privBytesPerSecond * 1e7
                  , o = i + n.chunk.buffer.byteLength / this.privBytesPerSecond * 1e7;
                if (e >= i && e <= o)
                    return n.chunk.timeReceived
            }
            return 0
        }
        ,
        e
    }();
    t.ReplayableAudioNode = n;
    var i = function(e, t, r) {
        this.chunk = e,
        this.serial = t,
        this.byteOffset = r
    }
}
, function(e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.ProxyInfo = void 0;
    var n = r(61)
      , i = function() {
        function e(e, t, r, n) {
            this.privProxyHostName = e,
            this.privProxyPort = t,
            this.privProxyUserName = r,
            this.privProxyPassword = n
        }
        return e.fromParameters = function(t) {
            return new e(t.getProperty(n.PropertyId.SpeechServiceConnection_ProxyHostName),parseInt(t.getProperty(n.PropertyId.SpeechServiceConnection_ProxyPort), 10),t.getProperty(n.PropertyId.SpeechServiceConnection_ProxyUserName),t.getProperty(n.PropertyId.SpeechServiceConnection_ProxyPassword))
        }
        ,
        e.fromRecognizerConfig = function(e) {
            return this.fromParameters(e.parameters)
        }
        ,
        Object.defineProperty(e.prototype, "HostName", {
            get: function() {
                return this.privProxyHostName
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Port", {
            get: function() {
                return this.privProxyPort
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "UserName", {
            get: function() {
                return this.privProxyUserName
            },
            enumerable: !1,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "Password", {
            get: function() {
                return this.privProxyPassword
            },
            enumerable: !1,
            configurable: !0
        }),
        e
    }();
    t.ProxyInfo = i
}
, function(e, t, r) {
    "use strict";
    var n = this && this.__awaiter || function(e, t, r, n) {
        return new (r || (r = Promise))((function(i, o) {
            function s(e) {
                try {
                    c(n.next(e))
                } catch (e) {
                    o(e)
                }
            }
            function a(e) {
                try {
                    c(n.throw(e))
                } catch (e) {
                    o(e)
                }
            }
            function c(e) {
                var t;
                e.done ? i(e.value) : (t = e.value,
                t instanceof r ? t : new r((function(e) {
                    e(t)
                }
                ))).then(s, a)
            }
            c((n = n.apply(e, t || [])).next())
        }
        ))
    }
      , i = this && this.__generator || function(e, t) {
        var r, n, i, o, s = {
            label: 0,
            sent: function() {
                if (1 & i[0])
                    throw i[1];
                return i[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (r)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (r = 1,
                            n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n),
                            0) : n.next) && !(i = i.call(n, o[1])).done)
                                return i;
                            switch (n = 0,
                            i && (o = [2 & o[0], i.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                i = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                n = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(i = s.trys,
                                (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && s.label < i[1]) {
                                    s.label = i[1],
                                    i = o;
                                    break
                                }
                                if (i && s.label < i[2]) {
                                    s.label = i[2],
                                    s.ops.push(o);
                                    break
                                }
                                i[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            n = 0
                        } finally {
                            r = i = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
      , o = this && this.__importDefault || function(e) {
        return e && e.__esModule ? e : {
            default: e
        }
    }
    ;
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    t.RestMessageAdapter = t.RestRequestType = void 0;
    var s, a = r(4), c = o(r(248));
    !function(e) {
        e.Get = "GET",
        e.Post = "POST",
        e.Delete = "DELETE",
        e.File = "file"
    }(s = t.RestRequestType || (t.RestRequestType = {}));
    var u = function() {
        function e(e) {
            if (!e)
                throw new a.ArgumentNullError("configParams");
            this.privHeaders = e.headers,
            this.privIgnoreCache = e.ignoreCache
        }
        return e.extractHeaderValue = function(e, t) {
            var r = "";
            try {
                var n = t.trim().split(/[\r\n]+/)
                  , i = {};
                n.forEach((function(e) {
                    var t = e.split(": ")
                      , r = t.shift().toLowerCase()
                      , n = t.join(": ");
                    i[r] = n
                }
                )),
                r = i[e.toLowerCase()]
            } catch (e) {}
            return r
        }
        ,
        Object.defineProperty(e.prototype, "options", {
            set: function(e) {
                this.privHeaders = e.headers,
                this.privIgnoreCache = e.ignoreCache
            },
            enumerable: !1,
            configurable: !0
        }),
        e.prototype.setHeaders = function(e, t) {
            this.privHeaders[e] = t
        }
        ,
        e.prototype.request = function(e, t, r, o, u) {
            var p = this;
            void 0 === r && (r = {}),
            void 0 === o && (o = null),
            void 0 === u && (u = null);
            var l, f, h = new a.Deferred, v = e === s.File ? "POST" : e, d = function(e, t) {
                void 0 === t && (t = {});
                var r = e;
                return {
                    data: JSON.stringify(t),
                    headers: JSON.stringify(e.headers),
                    json: t,
                    ok: e.statusCode >= 200 && e.statusCode < 300,
                    status: e.statusCode,
                    statusText: t.error ? t.error.message : r.statusText ? r.statusText : r.statusMessage
                }
            }, y = function(o) {
                c.default(t, v, p.privHeaders, 200, 201, 202, 204, 400, 401, 402, 403, 404)("" === p.queryParams(r) ? "" : "?" + p.queryParams(r), o).then((function(t) {
                    return n(p, void 0, void 0, (function() {
                        var r;
                        return i(this, (function(n) {
                            switch (n.label) {
                            case 0:
                                return e !== s.Delete && 204 !== t.statusCode ? [3, 1] : (h.resolve(d(t)),
                                [3, 3]);
                            case 1:
                                return [4, t.json()];
                            case 2:
                                r = n.sent(),
                                h.resolve(d(t, r)),
                                n.label = 3;
                            case 3:
                                return [2]
                            }
                        }
                        ))
                    }
                    ))
                }
                )).catch((function(e) {
                    h.reject(e)
                }
                ))
            };
            if (this.privIgnoreCache && (this.privHeaders["Cache-Control"] = "no-cache"),
            e === s.File && u) {
                var g = "multipart/form-data";
                this.privHeaders["content-type"] = g,
                this.privHeaders["Content-Type"] = g,
                "undefined" != typeof Blob && u instanceof Blob ? (l = u,
                f = new FileReader,
                f.readAsArrayBuffer(l),
                new Promise((function(e) {
                    f.onloadend = function() {
                        e(f.result)
                    }
                }
                ))).then((function(e) {
                    y(e)
                }
                )).catch((function(e) {
                    h.reject(e)
                }
                )) : y(u)
            } else
                e === s.Post && o && (this.privHeaders["content-type"] = "application/json",
                this.privHeaders["Content-Type"] = "application/json"),
                y(o);
            return h.promise
        }
        ,
        e.prototype.withQuery = function(e, t) {
            void 0 === t && (t = {});
            var r = this.queryParams(t);
            return r ? e + (-1 === e.indexOf("?") ? "?" : "&") + r : e
        }
        ,
        e.prototype.queryParams = function(e) {
            return void 0 === e && (e = {}),
            Object.keys(e).map((function(t) {
                return encodeURIComponent(t) + "=" + encodeURIComponent(e[t])
            }
            )).join("&")
        }
        ,
        e
    }();
    t.RestMessageAdapter = u
}
, function(e, t, r) {
    "use strict";
    const n = r(249);
    class i extends Error {
        constructor(e, ...t) {
            let r;
            super(...t),
            Error.captureStackTrace && Error.captureStackTrace(this, i),
            this.name = "StatusError",
            this.message = e.statusMessage,
            this.statusCode = e.status,
            this.res = e,
            this.json = e.json.bind(e),
            this.text = e.text.bind(e),
            this.arrayBuffer = e.arrayBuffer.bind(e);
            Object.defineProperty(this, "responseBody", {
                get: ()=>(r || (r = this.arrayBuffer()),
                r)
            }),
            this.headers = {};
            for (const [t,r] of e.headers.entries())
                this.headers[t.toLowerCase()] = r
        }
    }
    e.exports = n(((e,t,r,n,o)=>async(s,a,c={})=>{
        s = o + (s || "");
        let u = new URL(s);
        if (n || (n = {}),
        u.username && (n.Authorization = "Basic " + btoa(u.username + ":" + u.password),
        u = new URL(u.protocol + "//" + u.host + u.pathname + u.search)),
        "https:" !== u.protocol && "http:" !== u.protocol)
            throw new Error(`Unknown protocol, ${u.protocol}`);
        if (a)
            if (a instanceof ArrayBuffer || ArrayBuffer.isView(a) || "string" == typeof a)
                ;
            else {
                if ("object" != typeof a)
                    throw new Error("Unknown body type.");
                a = JSON.stringify(a),
                n["Content-Type"] = "application/json"
            }
        c = new Headers({
            ...n || {},
            ...c
        });
        const p = await fetch(u, {
            method: t,
            headers: c,
            body: a
        });
        if (p.statusCode = p.status,
        !e.has(p.status))
            throw new i(p);
        return "json" === r ? p.json() : "buffer" === r ? p.arrayBuffer() : "string" === r ? p.text() : p
    }
    ))
}
, function(e, t, r) {
    "use strict";
    const n = new Set(["json", "buffer", "string"]);
    e.exports = e=>(...t)=>{
        const r = new Set;
        let i, o, s, a = "";
        return t.forEach((e=>{
            if ("string" == typeof e)
                if (e.toUpperCase() === e) {
                    if (i) {
                        throw new Error(`Can't set method to ${e}, already set to ${i}.`)
                    }
                    i = e
                } else if (e.startsWith("http:") || e.startsWith("https:"))
                    a = e;
                else {
                    if (!n.has(e))
                        throw new Error(`Unknown encoding, ${e}`);
                    o = e
                }
            else if ("number" == typeof e)
                r.add(e);
            else {
                if ("object" != typeof e)
                    throw new Error("Unknown type: " + typeof e);
                if (Array.isArray(e) || e instanceof Set)
                    e.forEach((e=>r.add(e)));
                else {
                    if (s)
                        throw new Error("Cannot set headers twice.");
                    s = e
                }
            }
        }
        )),
        i || (i = "GET"),
        0 === r.size && r.add(200),
        e(r, i, o, s, a)
    }
}
]);
